Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Int

From Teriock
Revision as of 23:14, 25 May 2025 by Gpe (talk | contribs) (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")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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