MMOMinion
GUI_NewCheckbox in Loops? - Printable Version

+- MMOMinion (https://www.mmominion.com)
+-- Forum: FFXIVMinion (https://www.mmominion.com/forumdisplay.php?fid=87)
+--- Forum: [DOWNLOADS] Addons, Lua Modules, Navigation Meshes.. (https://www.mmominion.com/forumdisplay.php?fid=90)
+---- Forum: I Need Help with LUA coding! (https://www.mmominion.com/forumdisplay.php?fid=104)
+---- Thread: GUI_NewCheckbox in Loops? (/showthread.php?tid=5144)



GUI_NewCheckbox in Loops? - MAHA - 11-22-2013

Hi All,
I have a question about GUI_NewCheckbox
if I have a loop, how can I check whether the checkbox is on or off?
The query is stored here in "JD"..k so JD1, JD2, etc.. Unfortunately, you can not define a variable, only a string.

but now I want to let the query run in a loop, since the number of checkboxes are dynamic.


here is an example

PHP Code:
...
for 
1,40 do
  
GUI_NewCheckbox("TestBox","John Do Nr."..k,"JD"..k,"Delete Name")        
end
... 


I tried it with an array, but it does not work Complaint

PHP Code:
...
local JDcheck = {}
for 
1,40 do
  
GUI_NewCheckbox("TestBox","John Do Nr."..k,JDcheck[k],"Delete Name")        
end
... 

thank you
MAHA


RE: GUI_NewCheckbox in Loops? - HansW - 11-23-2013

if ( _G["JD"..k] == "1" ) then


RE: GUI_NewCheckbox in Loops? - MAHA - 11-23-2013

ahh that's right _G[...]
thank you