mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-02 12:24:11 -04:00
* Added a "nothing docstring" at the top of each file we want to generate docs for. We have to do this or ldoc just straight up refuses to generate docs otherwise. * Fixed up a few incorrect docstrings * config.ld is the config file for ldoc These still need some work: a bunch of functions are still undocumented and also: type.lua & run.lua are completely undocumented.
37 lines
817 B
Lua
37 lines
817 B
Lua
--- Component
|
|
|
|
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(populate)
|
|
local component = setmetatable({
|
|
__populate = populate,
|
|
|
|
__isComponent = true,
|
|
}, Component)
|
|
|
|
component.__mt = {__index = component}
|
|
|
|
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 = setmetatable({}, self.__mt)
|
|
self.__populate(bag, ...)
|
|
|
|
return bag
|
|
end
|
|
|
|
return true
|
|
end
|
|
|
|
return setmetatable(Component, {
|
|
__call = function(_, ...) return Component.new(...) end,
|
|
})
|