[meta] Improve documentation.

This commit is contained in:
Lorenzo Cogotti 2022-09-01 08:28:59 +02:00
parent c6f486bf9f
commit d49a9a1c21
1 changed files with 10 additions and 2 deletions

View File

@ -1,4 +1,4 @@
--- Functions dealing with metatables and tables merging.
--- Tables and metatables general utility algorithms.
--
-- @module gear.meta
-- @copyright 2022 The DoubleFourteen Code Forge
@ -7,7 +7,11 @@
local meta = {}
--- Test whether 'obj' is an instance of a given class 'cls'.
--- Test whether 'obj' is an instance of the given class 'cls'.
--
-- @tparam table obj
-- @tparam table cls
-- @treturn bool
function meta.isinstance(obj, cls)
repeat
local m = getmetatable(obj)
@ -25,6 +29,10 @@ end
-- table 'to', whenever the same field is nil in that table.
--
-- The same process is applied recursively to sub-tables.
--
-- @tparam table to table to merge into
-- @tparam table from table to merge from
-- @treturn table destination table (a reference to 'to')
function meta.mergetable(to, from)
for k,v in pairs(from) do
if to[k] == nil then