Entityindexer

Here is way to index all entities into one table, reachable everywhere :

Add to the very top of App.lua

function Callback(entity) App.entities[entity] = entity end

Replace Map:Load in App:Start() using this :

    --Load the starting map
    local mapfilename=System:GetProperty("map","Maps/start.map")
    if Map:Load(mapfilename,"Callback")==false then return false end

You can now get any loaded entity in any lua script. Ex get camera :

    for k, v in next, App.entities do
          if v:GetClass()==Object.CameraClass then
               camera=v
               break
          end
    end
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License