Module:Portal bar/sandbox: Difference between revisions

Content deleted Content added
sandboxify
use getArgs
Line 5:
local getImageName = require( 'Module:Portal' ).image
local yesno = require( 'Module:Yesno' )
local getArgs = require('Module:Arguments').getArgs
local p = {}
 
Line 167 ⟶ 168:
-- Processes external arguments and sends them to the other functions.
function p.main( frame )
local origArgs = getArgs(frame)
-- If called via #invoke, use the args passed into the invoking template, or
-- the args passed to #invoke if any exist. Otherwise assume args are being
-- passed directly in from the debug console or from another Lua module.
local origArgs
if type( frame.getParent ) == 'function' then
origArgs = frame:getParent().args
for k, v in pairs( frame.args ) do
origArgs = frame.args
break
end
else
origArgs = frame
end
-- Process the args to make an array of portal names that can be used with
-- ipairs. We need to use ipairs because we want to list all the portals in
Line 192 ⟶ 181:
if mw.ustring.find( v, '%S' ) then -- Remove blank values.
table.insert( portals, k )
end
elseif type( k ) ~= 'number' then -- Separate named arguments from portals.
if type( v ) == 'string' then
v = mw.text.trim( v )