Code: Select all
Map[1] = {x=0,y=1, variables = {1,2,3}}
Code: Select all
Map[1].tile = 24
Map[1].AnimTable = {}
Map[1].Treasure = 42
Is there a syntax?
Code: Select all
Map[1] = {x=0,y=1, variables = {1,2,3}}
Code: Select all
Map[1].tile = 24
Map[1].AnimTable = {}
Map[1].Treasure = 42
Assuming you cannot set the values during the creation of map[1] such as:Bindie wrote: snip
Code: Select all
Map[1] =
{
x=0,
y=1,
variables = {1,2,3},
tile = 24,
AnimTable = {},
Treasure = 42
}
Code: Select all
local a = Map[1]
a.tile = 24
a.AnimTable = {}
a.Treasure = 42
Code: Select all
for i,v in pairs( Map )
if type( v ) == "table" then
v.tile = 24
v.AnimTable = {}
v.Treasure = 42
end
end
Code: Select all
local Map = {
[1] = {},
[2] = { [1] = {} }
}
local function iterateTable( t, func )
if type(t) == "table" then
for i,v in pairs(t) do
iterateTable( v, func )
end
func(t)
end
end
iterateTable( Map, function(t)
t.tile = 24
t.AnimTable = {}
t.Treasure = 42
end )
Code: Select all
local m = Map[1]
m.tile = 24
m.AnimTable = {}
m.Treasure = 42
Users browsing this forum: Bing [Bot] and 5 guests