Changes
apply changes from sandbox - all tests pass
local function tidyValNoChange(key, val)
return val
end
local function matchesTitle(given, title)
local tp = type( given )
return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title
end
local title = parent:getTitle():gsub('/sandbox$', '')
local found = false
if matchesTitle(options.wrappers, title) then found = true elseif type(options.wrappers) == 'table' then
for _,v in pairs(options.wrappers) do
if matchesTitle(v == , title ) then
found = true
break
end
end
end
setmetatable(args, metatable)
local function mergeArgs(iterator, tables)
--[[
-- Accepts multiple tables as input and merges their keys and values
-- into one table using the specified iterator. If a value is already -- present it is not overwritten; -- tables listed earlier have precedence. -- We are also memoizing nil -- values, which can be overwritten if they -- are 's' (soft).
--]]
for _, t in ipairs(tables) do
for key, val in iteratorpairs(t) do
if metaArgs[key] == nil and nilArgs[key] ~= 'h' then
local tidiedVal = tidyVal(key, val)
-- Called when pairs is run on the args table.
if not metatable.donePairs then
mergeArgs(pairs, argTables)
metatable.donePairs = true
end
return pairs(metaArgs)
end
local function inext(t, i)
-- This uses our __index metamethod
local v = t[i + 1]
if v ~= nil then
return i + 1, v
end
end
metatable.__ipairs = function (t)
-- Called when ipairs is run on the args table.
end