Module:ISO 3166/sandbox: Difference between revisions

Content deleted Content added
Undefined variable reference checking could have helped!
m Formatting; comments
Line 100:
 
function p.luacode(args, skipHyphenSplit)
local country, subdivision = args[1], args[2]
--error(country)
if not skipHyphenSplit then
Line 109:
end
 
--error(mw.dumpObject(args))
if country then country = p.strip(country) end
if subdivision then subdivision = p.strip(subdivision) end
--error(mw.dumpObject(args))
if args["codetype"]=="3" then
Line 175 ⟶ 171:
local args = getArgs(frame)
local unhyphenateResult = p.luacode(args) -- Prioritize splitting on hyphen (subdivision).
local unhyphenateResult = p.luacode(args)
if unhyphenateResult ~= nil and unhyphenateResult ~= '' then
return unhyphenateResult
end
if string.find(args[1] or '', "%-") then -- If thereit ismight make a hyphendifference, try again by notwithout splitting.
if string.find(args[1] or '',"%-") then
local keepHyphenResult = p.luacode(args, true)
return keepHyphenResult or ''
end
return ''
end