Class: minor fixes
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
local setMetaTable, TableCopy = setmetatable, table.copy_with_metatables
|
||||
local setMetaTable, tableCopy = setmetatable, table.copy_with_metatables
|
||||
|
||||
---@class Class
|
||||
Class = {}
|
||||
|
||||
---Returns a child class with inherited parameters from the parent class.
|
||||
---@param parent table
|
||||
---@param child table
|
||||
function Class.extend(parent ,child)
|
||||
return setmetatable(child or {}, { __index = TableCopy(parent) })
|
||||
---@param child table?
|
||||
function Class.extend(parent, child)
|
||||
return setMetaTable(child or {}, { __index = tableCopy(parent) })
|
||||
end
|
||||
|
||||
---Intended for class constructors.
|
||||
@@ -23,7 +23,7 @@ function Class.getInstance(self, params, metatable)
|
||||
metatable = {}
|
||||
end
|
||||
|
||||
metatable.__index = TableCopy(self)
|
||||
metatable.__index = tableCopy(self)
|
||||
|
||||
local instance = setMetaTable(params, metatable)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user