Module:Sandbox/Mr. Stradivarius/sandbox3: Difference between revisions

Content deleted Content added
switch to an object-oriented approach
add alias-matching function
Line 44:
else
return false
end
end
 
-- Checks an array of aliases or an alias string against a table of arguments.
-- If a match is found, returns the argument value, and if not returns nil.
-- All non-nil values are matched. If there is more than one match, returns the
-- match for the first matching alias in the list.
local function matchParam( args, aliases )
if type( args ) ~= 'table' then return end
if type( aliases ) == 'table' then
for i, alias in ipairs( aliases ) do
alias = checkString( alias )
if alias then
local argMatch = args[ alias ]
if argMatch ~= nil then
return argMatch
end
end
end
elseif checkString( aliases ) then
local myRowalias = row:new()aliases
local argMatch = args[ alias ]
if argMatch then
return argMatch
end
end
end
Line 221 ⟶ 246:
 
function p.test( frame )
local myRow = row:new()
return row:export()
end
 
 
return p