Differenze tra le versioni di "Modulo:Wikilib/tables"

Jump to navigation Jump to search
m
Adding copy and values
(Adding flatMap)
m (Adding copy and values)
 
t.keys = table.keys
 
--[[
 
Returns a numeric table containing the values of the passed table, in the
order they are returned in by the iterator. Such iterator defaults to pairs,
and should return two values, the first being the key and the second the value.
 
--]]
table.values = function(tab, iter)
iter = iter or pairs
 
local values = {}
for _, value in iter(tab) do
table.insert(values, value)
end)
return vvalues
end
 
t.values = table.values
 
--[[
 
--]]
table.cloneLoadDatacopy = function(value)
local dest = {}
return table.map(value, function(v)
for k, v in if pairs(type(v) == 'table'value) thendo
dest[k] = type(v) == return 'table.cloneLoadData(v)'
else and table.copy(v)
-- ifor v isn't a table, is a bool, num or string
end
return v
return enddest
end)
end
 
tablet.clone_load_datacopy = table.cloneLoadDatacopy
table.cloneLoadData, table.clone_load_data =
table.copy, table.copy
t.cloneLoadData, t.clone_load_data =
table.cloneLoadData copy, table.cloneLoadDatacopy
 
return t

Menu di navigazione