Module:Sandbox/Ahecht: Difference between revisions

Content deleted Content added
don't transform custom values
default to ___location 1
Line 39:
-- val exists and isn't blank
local loc = tonumber(mw.ustring.sub(k,-1))
if (loc) and (loc > 0) and (loc <= 10)
and (not mw.ustring.match(k, "^location_%d+$"))
and (not mw.ustring.match(k, "^custom_")) then
-- last character is a number 1-10, and it's not "location_#" or "custom_"
if not args[loc] then args[loc] = {} end
args[loc] = {}
end
-- strip "location_" and number from key
local key = mw.ustring.gsub(mw.ustring.gsub(k, "_?%d+$", ""), "^location_", "")
args[loc][key] = val
elseif (not loc) and (mw.ustring.match(k, "^location_%D")) then
-- default to ___location 1
if (not args[1]) then args[1] = {} end
-- strip "location_" from key
local key = mw.ustring.gsub(k, "^location_", "")
args[loc1][key] = {}val
else
args[0][k] = val