Entities Spawn

Okay, i’m curious; Does anyone know how i would go about getting all entities from my gamemode, in the map…and output their positions in a table? and on Creating a function for each type of entity with the table as their locations?

Sort of like this.
[lua]
function Bub(ply,cmd,args)
BubbleLocations = {}
BubbleLocations[“bubble1”] = {
Loc = “555.03350830078,-507.82836914063,-55.0482635498”
}
BubbleLocations[“bubble2”] = {
Loc = “812.53845214844,-901.52972412109,-50.0482635498”
}

for k,v in pairs(BubbleLocations) do
local Bubble = ents.Create(“bubble”);

Bubble:SetPos(Vector(v.Loc));
Bubble:Spawn();
Bubble:Activate()
return "";
end

end
[/lua]

But what i’m asking, is there a way , maybe not get all entity…but when i spawn an entity…add it’s location to the table?


(User was banned for this post ("Wrong section" - mahalis))

What do you mean? You already use locations, re-using the pos of them doesnt make sense.