mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-02 12:24:11 -04:00
Automate naming process
This commit is contained in:
parent
e0f88025ba
commit
144a42dc9e
7 changed files with 78 additions and 53 deletions
|
@ -1,26 +1,17 @@
|
|||
--- Component
|
||||
|
||||
local PATH = (...):gsub('%.[^%.]+$', '')
|
||||
|
||||
local Components = require(PATH..".components")
|
||||
|
||||
local Component = {}
|
||||
Component.__index = Component
|
||||
|
||||
--- Creates a new Component.
|
||||
-- @param populate A function that populates the Bag with values
|
||||
-- @return A Component object
|
||||
function Component.new(name, populate)
|
||||
if (type(name) ~= "string") then
|
||||
error("bad argument #1 to 'Component.new' (string expected, got "..type(name)..")", 2)
|
||||
end
|
||||
|
||||
function Component.new(populate)
|
||||
if not (type(populate) == "function") then
|
||||
error("bad argument #2 to 'Component.new' (function expected, got "..type(populate)..")", 2)
|
||||
error("bad argument #1 to 'Component.new' (function expected, got "..type(populate)..")", 2)
|
||||
end
|
||||
|
||||
local baseComponent = setmetatable({
|
||||
__name = name,
|
||||
__populate = populate,
|
||||
|
||||
__isBaseComponent = true,
|
||||
|
@ -28,8 +19,6 @@ function Component.new(name, populate)
|
|||
|
||||
baseComponent.__mt = {__index = baseComponent}
|
||||
|
||||
Components.register(name, baseComponent)
|
||||
|
||||
return baseComponent
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue