 # about tables

hello, is it possible to put 3 numbers in a table, say for a pos or something like this?

``````

postable = {}
postable= (111,111,222)
postable= (222,111,333)

local r = math.random(2)
local pos = postable[r]

``````

or is it impossible? or would i have to do this?

``````

postableX = {}
postableX= 111
postableX= 222

postableY = {}
postableY= 111
postableY= 111

postableZ = {}
postableZ= 222
postableZ= 333

local r = math.random(2)

local posX= postableX[r]
local posY= postableY[r]
local posZ= postableZ[r]

``````

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 = { 111, 111 }
postable = { 222, 111 }

local r = math.random( 2 )
local posX = postable[r]
local posY = postable[r][/lua]

Edit: Now that you’ve changed your post to use 3 coordinates, use Dave_Parker’s method.

[lua]postable = {}
postable = Vector(111,222,333)
postable = Vector(444,555,666)

local r = table.Random(postable)
[/lua]
Or what Overv posted.