I'm using Lua with IUP and have a number of pairs of IUP handles thus:
UseField1 = iup.toggle {blah blah blah}
Field1Label = iup.text {blah blah blah}
The number of field pairs (maxFields) is currently 5 but may vary.
At various places in my Lua programme, I need to do something like:
for N in 1,maxFields do
If UseFieldN.value =="ON" then
DoSomethingWith(FieldNLabel.value, N)
end
end
I know I can't construct dynamic variable names, but is there a way to write this as a concise loop , rather than:
If UseField1 =="ON" then DoSomethingWith(Field1Label.value, 1) end
If UseField2 =="ON" then DoSomethingWith(Field2Label.value, 2) end
etc