From 4d39f5e52e1ca9e26a397eb4bcc2fe7bad18cdfe Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 9 Jun 2008 07:05:06 +0000 Subject: Corrected the mapper to do proper error checking. --- server/xml/macros/example.xml | 19 +++++++++++++++++-- 1 file 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 - -- 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 -- cgit v1.2.3