Saving entities to tables

[lua]
spawns = { }
function SavePositions( )
print(“looking for stuff…”)
–Save ents so we don’t have to search again and again
for a, b in pairs( ents.FindByName( “mg_start_spawn” ) ) do
print("Found a start spawn " … a)
table.insert( spawns[‘start’], b )
end
print(table.ToString(spawns,“spawns”,true))
end
hook.Add( “InitPostEntity”, “SavePositions”, SavePositions )
[/lua]

Crazy table stuff, but it doesn’t work. It always echoes


spawns	=	{
}

but for some reason, this works:
[lua]
local water = { }
local function SaveWater( )
print(“looking for spawners…”)
–Save ents so we don’t have to search again and again
for k, v in pairs( ents.FindByName( “zombiemaker1” ) ) do
table.insert( water, v )
print(“Found a zombie spawner!”)
end
end
hook.Add( “InitPostEntity”, “SaveWater”, SaveWater )
[/lua]

and the only difference is what it inserts into

:open_mouth: doesn’t look right, look at this and see if there is anything wrong:
[lua]spawns = { }
function SavePositions( )
print(“A nice juicy penis for you to insert into yourself.”)
–Save ents so we don’t have to search again and again
for a, b in pairs( ents.FindByName( “mg_start_spawn” ) ) do
print("Found a start spawn " … a)
table.insert( spawns[‘start’], b )
end
print(table.ToString(spawns,“spawns”,true))
end
hook.Add( “InitPostEntity”, “SavePositions”, SavePositions )
[/lua]

Odd, that works.

[editline]07:26PM[/editline]

Edit: Seriously

0_0