mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-02 04:13:58 -04:00
Delete component.lua
This commit is contained in:
parent
bad5e2c0ab
commit
0971a0c096
1 changed files with 0 additions and 41 deletions
|
@ -1,41 +0,0 @@
|
||||||
local Component = {}
|
|
||||||
Component.__index = Component
|
|
||||||
|
|
||||||
--- Creates a new Component.
|
|
||||||
-- @param populate A function that populates the Bag with values
|
|
||||||
-- @param inherit States if the Bag should inherit the Component's functions
|
|
||||||
-- @return A Component object
|
|
||||||
function Component.new(populate, inherit)
|
|
||||||
local component = setmetatable({
|
|
||||||
__populate = populate,
|
|
||||||
__inherit = inherit,
|
|
||||||
}, Component)
|
|
||||||
|
|
||||||
if inherit then
|
|
||||||
component.__mt = {__index = component}
|
|
||||||
end
|
|
||||||
|
|
||||||
return component
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Creates and initializes a new Bag.
|
|
||||||
-- @param ... The values passed to the populate function
|
|
||||||
-- @return A new initialized Bag
|
|
||||||
function Component:__initialize(...)
|
|
||||||
if self.__populate then
|
|
||||||
local bag = {}
|
|
||||||
self.__populate(bag, ...)
|
|
||||||
|
|
||||||
if self.__inherit then
|
|
||||||
setmetatable(bag, self.__mt)
|
|
||||||
end
|
|
||||||
|
|
||||||
return bag
|
|
||||||
end
|
|
||||||
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
return setmetatable(Component, {
|
|
||||||
__call = function(_, ...) return Component.new(...) end,
|
|
||||||
})
|
|
Loading…
Add table
Add a link
Reference in a new issue