I have a table:
local table = { obj1, obj2, obj3, obj4, obj5, obj6}
And I would like to convert that table into a 2 dimensional table ( a grid ):
local grid = {} local columns = 4 local rows = 4 for x=1,columns do grid[x] = {} for y=1,rows do grid[x][y] = table[??] end end
Also how to deal with the situation if the first table has fewer values than the columns/rows?