Add helper functions to container. Allow name to be gotten

This commit is contained in:
Tjakka5 2020-01-04 13:40:18 +01:00
parent 6cd66e6737
commit 55ae5fd987
8 changed files with 97 additions and 2 deletions

View file

@ -53,8 +53,10 @@ System.mt = {
-- @return A new SystemClass
function System.new(...)
local systemClass = setmetatable({
__isSystemClass = true,
__filter = {...},
__name = nil,
__isSystemClass = true,
}, System.mt)
systemClass.__index = systemClass
@ -178,6 +180,18 @@ function System:getWorld()
return self.__world
end
--- Returns true if the System has a name.
-- @return True if the System has a name, false otherwise
function System:hasName()
return self.__name and true or false
end
--- Returns the name of the System.
-- @return Name of the System
function System:getName()
return self.__name
end
--- Callback for system initialization.
-- @param world The World the System was added to
function System:init(world) -- luacheck: ignore