Many thanks for the insight.
BTW I've come to the conclusion that CHDK Lua doesn't support GOTO: I'm I right?
Correct. CHDK uses Lua 5.1, which does not have a GOTO. See
http://www.lua.org/manual/5.1/Generally, I'd suggest breaking things into functions and using returns for an early out.
If you need to share state among functions, using tables in the object:foo() style can be helpful.
edit:
But as @reyalp is the CHDK Lua expert (and AFAIK the person who added it to CHDK) I will defer comments to him.
To give due credit, the original CHDK Lua implementation was contributed by Velo
https://chdk.setepontos.com/index.php/topic,1194.0.htmlThe reason CHDK is still on 5.1 is that a fair bit of hacking to the Lua source was required to make it work within the limitations of CHDK, and in my experience Lua 5.1 is quite adequate for complex scripts.