summaryrefslogtreecommitdiff
path: root/server/xml/macros
diff options
context:
space:
mode:
authordeva <deva>2008-06-09 07:05:06 +0000
committerdeva <deva>2008-06-09 07:05:06 +0000
commit4d39f5e52e1ca9e26a397eb4bcc2fe7bad18cdfe (patch)
treefaab05706ee4712594e5e4f5a2a5983ba8b44d83 /server/xml/macros
parente80ccdfac750fdd318eecb35b5f48a3d251ec7ec (diff)
Corrected the mapper to do proper error checking.
Diffstat (limited to 'server/xml/macros')
-rw-r--r--server/xml/macros/example.xml19
1 files changed, 17 insertions, 2 deletions
diff --git a/server/xml/macros/example.xml b/server/xml/macros/example.xml
index 635dea2..f875747 100644
--- a/server/xml/macros/example.xml
+++ b/server/xml/macros/example.xml
@@ -9,8 +9,23 @@
return math.pi, 1234567890
</map>
<map name="cyl">
- -- LUA program
- return lensmeter.right.cyl.value, lensmeter.right.cyl.timestamp
+ -- Returning 0, 0 invalidates the result
+ value = 0
+ timestamp = 0
+
+ -- Check for the existence of each level.
+ if( lensmeter and
+ lensmeter.right and
+ lensmeter.right.cyl and
+ lensmeter.right.cyl.value and
+ lensmeter.right.cyl.timestamp )
+ then
+ timestamp = lensmeter.right.cyl.value
+ value = lensmeter.right.cyl.value end
+ end
+ end
+
+ return value, timestamp
</map>
</maps>
<luaprograms>