Module:Sandbox/Jackmcbarn: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
for Iraq now
Jackmcbarn (talk | contribs)
Reverted to revision 623263051 by Jackmcbarn (talk). (TW)
Line 1:
local p = {}
 
function p.markmain(frame)
local argsToReturnargs, args_mt = { '__pairs was not used' }, {}
function args_mt.__pairs( t )
local extra = {}
return pairs( { 'success' } )
local args = {}
for k,v in pairs(frame.args) do
args[k] = v
end
return frame:expandTemplate{ title = 'Echo', args = setmetatable( args, args_mt ) }
for k,v in ipairs({'lat', 'long', 'mark', 'marksize', 'label', 'link', 'label_size', 'position'}) do
if args[v] then
table.insert(argsToReturn, string.format("%s = %q", v, mw.text.trim(args[v])))
args[v] = nil
end
end
if args[1] and mw.text.trim(args[1]) == 'Iraq' then args[1] = nil end
for k,v in pairs(args) do
table.insert(extra, 'EXTRA ' .. k .. ' = ' .. v)
end
if #extra > 0 then
error(table.concat(extra, ', '))
end
return '{ ' .. table.concat(argsToReturn, ', ') .. ' },'
end