mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-08-31 17:38:29 -04:00
Add helper functions to container. Allow name to be gotten
This commit is contained in:
parent
6cd66e6737
commit
55ae5fd987
8 changed files with 97 additions and 2 deletions
|
@ -24,8 +24,24 @@ function Assemblages.register(name, assemblage)
|
|||
end
|
||||
|
||||
Assemblages[name] = assemblage
|
||||
assemblage.__name = name
|
||||
end
|
||||
|
||||
--- Returns true if the containter has the Assemblage with the name
|
||||
-- @param name Name of the Assemblage to check
|
||||
-- @return True if the containter has the Assemblage with the name, false otherwise
|
||||
function Assemblages.has(name)
|
||||
return Assemblages[name] and true or false
|
||||
end
|
||||
|
||||
--- Returns the Assemblage with the name
|
||||
-- @param name Name of the Assemblage to get
|
||||
-- @return Assemblage with the name
|
||||
function Assemblages.get(name)
|
||||
return Assemblages[name]
|
||||
end
|
||||
|
||||
|
||||
return setmetatable(Assemblages, {
|
||||
__index = function(_, name)
|
||||
error("Attempt to index assemblage '"..tostring(name).."' that does not exist / was not registered", 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue