• about tables
    2 replies, posted
hello, is it possible to put 3 numbers in a table, say for a pos or something like this? [CODE] postable = {} postable[1]= (111,111,222) postable[2]= (222,111,333) local r = math.random(2) local pos = postable[r][/CODE] or is it impossible? or would i have to do this? [CODE] postableX = {} postableX[1]= 111 postableX[2]= 222 postableY = {} postableY[1]= 111 postableY[2]= 111 postableZ = {} postableZ[1]= 222 postableZ[2]= 333 local r = math.random(2) local posX= postableX[r] local posY= postableY[r] local posZ= postableZ[r][/CODE] because i need to randomly select a position so would i do it that way?
Yes, that is very possible. You must make a subtable like so: [lua]postable = {} postable[1] = { 111, 111 } postable[2] = { 222, 111 } local r = math.random( 2 ) local posX = postable[r][1] local posY = postable[r][2][/lua] [b]Edit:[/b] Now that you've changed your post to use 3 coordinates, use Dave_Parker's method.
Sorry, you need to Log In to post a reply to this thread.