79 553
contributi
(Fixing behaviour of shiny and female parameter in MiniSprite *** sovrascritto il testo esistente ***) |
(Updating some table functions to work better with mw.loaddata, and using them in various DebRes *** sovrascritto il testo esistente ***) |
||
local t = {}
-- Check whether a given value is an integer
local function isint(val)
return type(val) == "number" and val == math.floor(val)
end
-- Stateless iterator on non-integer keys
local function nextNonInt
local nextKey, nextValue = key, nil
repeat
nextKey, nextValue = next(tab, nextKey)
until
return nextKey, nextValue
end
-- Returns true only if a is lexigographically greater than b
local function minor
if not b then
return true
end
end
for key, value in
if not isint(key) and cond(value, key) then
dest[key] = value
end
table.insert(dest, value)
end
for key, value in
end
return dest
-- Stateless iterator to be used in for loops
---@deprecated
table.nonIntPairs = function(tab)
return nextNonInt, tab
end
-- Predicate search. Returns the index of any value satisfying the predicate,
for key, value in table.nonIntPairs(tab) do
▲ --[[
▲ If value is not in check, minor returns true, as the second
▲ argument is nil
▲ --]]
if minor(key, check[value]) then
check[value] = key
end
t.groupBy = table.groupBy
--[[
Insert into a list all elements from another list. The third parameter is an
optional iterator to specify how to get elements from the second list (default
to ipairs).
--]]
table.append = function(list, elems, iter)
iter = iter or ipairs
for _, v in iter(elems) do
table.insert(list, v)
end
return list
end
t.append = table.append
return t
|