More actions
Content deleted Content added
Created page with "local p = {} function p.main(frame) local input = frame.args[1] or '' -- Strip wiki formatting input = mw.ustring.gsub(input, "'''''", "") -- bold+italic input = mw.ustring.gsub(input, "'''", "") -- bold input = mw.ustring.gsub(input, "''", "") -- italic -- Attempt to parse as number local num = tonumber(input) if num then return math.floor(num + 0.5) else return 0 -- default fallback end end return p" |
(No difference)
|
Latest revision as of 23:14, 25 May 2025
Documentation for this module may be created at Module:Int/doc
local p = {}
function p.main(frame)
local input = frame.args[1] or ''
-- Strip wiki formatting
input = mw.ustring.gsub(input, "'''''", "") -- bold+italic
input = mw.ustring.gsub(input, "'''", "") -- bold
input = mw.ustring.gsub(input, "''", "") -- italic
-- Attempt to parse as number
local num = tonumber(input)
if num then
return math.floor(num + 0.5)
else
return 0 -- default fallback
end
end
return p