local p = {}
-- compares arguments in unnamed parameters
-- returns the greatest among them
-- ci=1 case-insensitive comparison
-- versions=1 splits on whitespace and compares tokens alphabetically,
-- except when tokens are all digits/periods,
-- in which case it splits the token on the period and compares the numbers numerically.
function p.base( ... )
p.current_frame = mw.getCurrentFrame()
local args = { ... }
if args[1] == p.current_frame then
args = require( 'Module:ProcessArgs' ).merge( true )
else
args = args[1]
end
local greatest = ""
for idx, arg in pairs(args) do
if type(idx) == "number"
and idx >= 1
and require( 'Module:StringCompare' ).base({ arg, greatest, ci = args.ci, versions = args.versions }) == 1 then
greatest = arg
end
end
return greatest
end
return p
Advertisement
Módulo:StringGreatest
Advertisement