Add entity:getWorld

This commit is contained in:
Tjakka5 2019-12-22 21:02:25 +01:00
parent 89443bd961
commit f6536d5a0e

View file

@ -11,7 +11,7 @@ Entity.__index = Entity
-- @return A new Entity -- @return A new Entity
function Entity.new() function Entity.new()
local e = setmetatable({ local e = setmetatable({
world = nil, __world = nil,
__addedComponents = {}, __addedComponents = {},
__removedComponents = {}, __removedComponents = {},
@ -164,6 +164,10 @@ function Entity:getComponents()
return self.__components return self.__components
end end
function Entity:getWorld()
return self.__world
end
return setmetatable(Entity, { return setmetatable(Entity, {
__call = function(_, ...) __call = function(_, ...)
return Entity.new(...) return Entity.new(...)