Is is possible to use try catch kind statements in Lua

  • 1 Replies
  • 586 Views
Is is possible to use try catch kind statements in Lua
« on: 27 / August / 2015, 06:26:00 »
Advertisements
In our multi camera project for some reason if a camera is shutdown or stops responding all the other cameras are also stopping as chdkptp gui is waiting for response of all cameras. Is it possible to ignore this kind of cameras during shot with mulitcameras using an exception handling statement.

*

Offline reyalp

  • ******
  • 11392
Re: Is is possible to use try catch kind statements in Lua
« Reply #1 on: 27 / August / 2015, 16:46:37 »
In our multi camera project for some reason if a camera is shutdown or stops responding all the other cameras are also stopping as chdkptp gui is waiting for response of all cameras. Is it possible to ignore this kind of cameras during shot with mulitcameras using an exception handling statement.
Lua uses error() and the protected calls (pcall or xpcall) for kind of thing. See http://www.lua.org/manual/5.2/manual.html#6.1

Note that chdkptp uses lua 5.2. The camera side code uses Lua 5.1, and has some additional CHDK specific restrictions on the use of protected calls.

That said, you can't just drop in some pcalls somewhere to solve your problem. chdkptp already uses error and protected calls extensively. You will need to adjust the logic in multicam.lua to somehow ignore the failed cameras. I don't know off the top of my head exactly what would need to be done, but it's likely non-trivial and may depend on the specific failure modes. Using the GUI adds another level of complexity.
Don't forget what the H stands for.

 

Related Topics