Lua Error Handling on Script Loops

Discussion created by darren.brewerton on Feb 5, 2009
Latest reply on Feb 6, 2009 by carstein.seeberg


We're trying to use the scripting interface to return a list of probes and their configurations using a few loops.

The script works fine until it finds a robot that has a communication error, because of a port problem for example.

When such a robot is found the script just quits.

The basic script structure is as follows.

The first nimbus.request gets a list of hubs in the domain.
The second nimbus.request then uses the 'getrobots' function on each hub to get each robot.

The remaining nimbus.request functions attempt to contact each robot while in the 'getrobots' iteration so we can query probes and their respective configurations.

In other languages we could use a 'continue' statement to jump round the problem robot if the nimbus.request returned a 'nil' value, which it seems to do when there is a communication error.

Lua doesn't seem to have a continue statement so we're stuck.  Does anyone have any suggestions?

For the sake of testing every robot under each hub the example script attached limits the requests using the USERTAG1 value.

Thanks in advance for the help.