It looks like you're new here. If you want to get involved, click one of these buttons!
local columnListOfGameTextBox ={{0,0},{0,0},{0,0},{0,0}} function createTextboxStage() -- **********creation des txtfields du stage for i=1, 4 do for j=1, 2 do local txtbox = TextField.new(nil, "ABC") stage:addChild(txtbox) columnListOfGameTextBox[i][j]= txtbox -- here I add the instance to my table end end printtbl(columnListOfGameTextBox) end function printtbl( t,tab,lookup ) local lookup = lookup or { [t] = 1 } local tab = tab or "" for i,v in pairs( t ) do print( tab..tostring(i), v ) if type(i) == "table" and not lookup[i] then lookup[i] = 1 print( tab.."Table: i" ) printtbl( i,tab.."\t",lookup ) end if type(v) == "table" and not lookup[v] then lookup[v] = 1 print( tab.."Table: v" ) printtbl( v,tab.."\t",lookup ) end end end createTextboxStage() |
Comments
1 table: 048A7C08
Table: v
1 0
2 0
2 table: 048A8580
Table: v
1 0
2 0
3 table: 048A7EC8
Table: v
1 0
2 0
4 table: 048A7F18
Table: v
1 0
2 0
Not sure what you mean about the first entry. What output did you want...? (I'm not sure what exactly you're trying to do...)
Likes: jimlev
I leave the 'problem' line commented in the sample code.
try it now (example above shows the pb)
here is the output I get :
SinisterSoft: “ I don't create classes that much - classes are good for making things simpler but imho for frame rate they are also death by a thousand cuts.”
Totebo: “ Best quote ever.”
🤔
(First the "printtb1" function is called with a single argument, then it calls itself with three arguments. I know Lua is fairly carefree about this kind of thing, but since it's apparently producing the wrong output the first time, I'm wondering if it's initially working with the wrong parameters. I don't understand what they should be though.)
I'm going to clean the code a "little bit" or, better, make a simplified version and try to explain the goal behind that mess
thx BJG
SinisterSoft: “ I don't create classes that much - classes are good for making things simpler but imho for frame rate they are also death by a thousand cuts.”
Totebo: “ Best quote ever.”
🤔