summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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>