Difference between revisions of "Module:BaseData"
com>Ckwng (Module for data base class.) |
m (8 revisions imported) |
||
| (7 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
| − | local BaseData = { | + | local BaseData = {} |
| − | |||
| − | |||
| − | } | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
function BaseData:create(data) | function BaseData:create(data) | ||
data = data or {} | data = data or {} | ||
| − | setmetatable(data, | + | setmetatable(data, data) |
| − | self. | + | data.__index = self |
| + | data.__call = self.__call | ||
return data | return data | ||
end | end | ||
Latest revision as of 11:51, 12 May 2021
Documentation for this module may be created at Module:BaseData/doc
local BaseData = {}
function BaseData:create(data)
data = data or {}
setmetatable(data, data)
data.__index = self
data.__call = self.__call
return data
end
BaseData.__call = function (table, ...)
return table:create(...)
end
setmetatable(BaseData, BaseData)
return BaseData