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

@ -24,6 +24,21 @@ function Worlds.register(name, world)
end
Worlds[name] = world
world.__name = name
end
--- Returns true if the containter has the World with the name
-- @param name Name of the World to check
-- @return True if the containter has the World with the name, false otherwise
function Worlds.has(name)
return Worlds[name] and true or false
end
--- Returns the World with the name
-- @param name Name of the World to get
-- @return World with the name
function Worlds.get(name)
return Worlds[name]
end
return setmetatable(Worlds, {