Module:Param Parse: Difference between revisions

Level range support
(going to merge episode + location pages bc there is no meaningful distinction)
(Level range support)
Line 21:
num = string.gsub(num or '',',','')
return tonumber(num)
end
 
-- Standardized number range
function parse.number_range(prenum)
local num = ""
local count = 0
for out in string.gmatch(prenum, "[^-]+") do
if count == 1 then
num = num .. "➨\n"
elseif count == 3 then
return
end
num = num .. string.gsub(out or '',',','')
count = count + 1
end
return num
end
 
Line 253 ⟶ 269:
end
if profession_valid and not level_valid then
-- Professioncheck definedif withoutits a level, invalid,range show an unknown levelinstead
level_valid = '?'parse.number_range(level)
if not level_valid then
category_error = true
-- Profession defined without level, invalid, show an unknown level
level_valid = '?'
category_error = true
end
end
return '[[File:'..profession_valid..' icon.png|x30px|link='..profession_valid_link..']] '..level_valid..(category_error and '[[Category:Invalid profession bubble]]' or '')
256

edits