27 lines
672 B
Lua
27 lines
672 B
Lua
require "ecs"
|
|
require "ecs.Wrapper"
|
|
|
|
manager = get_manager()
|
|
|
|
manager:view("TestThing"):for_each(function(ent)
|
|
data = ent:get_component("TestThing")
|
|
print("test: " .. data.test)
|
|
end)
|
|
|
|
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)
|
|
-- @todo You cannot concatenate bool to string
|
|
print("alive: ")
|
|
print(data.alive)
|
|
end)
|
|
|
|
-- @todo Allow this
|
|
-- for i, v in pairs(manager:view("TestThing")) do
|
|
-- print(i, v)
|
|
-- end
|
|
|
|
print(manager:has_entity("70bca3cf-33dd-40dc-8b0f-2e19aa0b4a17"))
|