ecs/test/test2.lua

22 lines
585 B
Lua

manager = get_manager()
manager:view("LuaData"):for_each(function(ent)
-- @todo It would be nice if this could somehow be passed in as function arg
data = ent:get_component("LuaData")
print("speed: " .. data.speed)
print("something: " .. data.something)
-- print("alive: " .. data.alive)
end)
manager:view("TestThing"):for_each(function(ent)
data = ent:get_component("TestThing")
print("test: " .. data.test)
end)
-- @todo Allow this
-- for i, v in pairs(manager:view("TestThing")) do
-- print(i, v)
-- end
print(manager:has_entity("6d58fdb5-6d8c-4e6f-89d4-f7d7b184f463"))