diff --git a/concord/component.lua b/concord/component.lua index eaf4f56..7e0ae2d 100644 --- a/concord/component.lua +++ b/concord/component.lua @@ -3,17 +3,14 @@ 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) +function Component.new(populate) local component = setmetatable({ __populate = populate, __inherit = inherit, }, Component) - if inherit then - component.__mt = {__index = component} - end + component.__mt = {__index = component} return component end @@ -23,13 +20,9 @@ end -- @return A new initialized Bag function Component:__initialize(...) if self.__populate then - local bag = {} + local bag = setmetatable({}, self.__mt) self.__populate(bag, ...) - if self.__inherit then - setmetatable(bag, self.__mt) - end - return bag end