Hello all, I am currently creating a little loop that gets a value from a database. What I want to do is expand it so I can do this more than twice (what it currently does now). Any thoughts or suggestions?
My code is:
local previous={} local i = 1 local firstvalue= {} local secondvalue={} for z=1,2 do local randtest=math.random(1,4) previous[z]=randtest if z==1 then for row in db:nrows("SELECT \* FROM tableWHERE ID="..randtest)do firstvalue[z] = row.value1 secondvalue[z] = row.value2 end else while randtest==previous[z-1]do randtest=math.random(1,4) end for row in db:nrows("SELECT \* FROM table WHERE ID="..randtest)do firstvalue[z] = row.value1 secondvalue[z] = row.value2 end end end
Apologies about the lack of indentation