mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-02 12:24:11 -04:00
Added named systems
This commit is contained in:
parent
038111d558
commit
d4efca976c
10 changed files with 176 additions and 92 deletions
|
@ -1,5 +1,9 @@
|
|||
--- Component
|
||||
|
||||
local PATH = (...):gsub('%.[^%.]+$', '')
|
||||
|
||||
local Components = require(PATH..".components")
|
||||
|
||||
local Component = {}
|
||||
Component.__index = Component
|
||||
|
||||
|
@ -15,10 +19,6 @@ function Component.new(name, populate)
|
|||
error("bad argument #2 to 'Component.new' (function/nil expected, got "..type(populate)..")", 2)
|
||||
end
|
||||
|
||||
if (Component[name] ~= nil) then
|
||||
error("bad argument #2 to 'Component.new' (Component with name '"..name.."' already exists", 2)
|
||||
end
|
||||
|
||||
local component = setmetatable({
|
||||
__name = name,
|
||||
__populate = populate,
|
||||
|
@ -28,7 +28,7 @@ function Component.new(name, populate)
|
|||
|
||||
component.__mt = {__index = component}
|
||||
|
||||
Component[name] = component
|
||||
Components.register(name, component)
|
||||
|
||||
return component
|
||||
end
|
||||
|
@ -51,4 +51,4 @@ return setmetatable(Component, {
|
|||
__call = function(_, ...)
|
||||
return Component.new(...)
|
||||
end,
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue