Module:Star
Jump to navigation
Jump to search
Module documentation
This documentation is transcluded from Module:Star/doc. [edit] [history] [purge]
Module:Star's function main is invoked by Template:StarXP.
Module:Star requires Module:Lamp.
Module:Star requires strict.
Module:Star is required by Module:Oddment calc.
| Function list |
|---|
| L 11 — p._level_to_xp L 21 — p._xp_to_level L 26 — p._main L 32 — p.main L 36 — p.xp_to_level L 41 — p.level_to_xp |
This module serves as a collection of wrapper functions meant for easy, symbolic access the functionality which has been moved to Module:Lamp. For more information about that functionality, see that module or its full documentation.
require("strict");
local lamp = require('Module:Lamp')
local p = {}
-- Returns the xp gained from a star at a given level and multiplier
-- level: Level to query
-- multiplier: Size of the star as a case-insensitive string ("Small", "Medium", "Large", "Huge") or a raw numeric value
--
-- returns xp as an unformatted number
function p._level_to_xp(level, multiplier)
return lamp._level_to_xp(level, multiplier, true)
end
-- Returns the level required to gain the provided amount of xp
-- xp: Amount of xp to query
-- multiplier: Size of the star as a case-insensitive string ("Small", "Medium", "Large", "Huge") or a raw numeric value
-- (overflow): Whether to consider stars that would provide more than the requested xp (default: true)
--
-- returns level as an unformatted number
function p._xp_to_level(xp, multiplier, overflow)
return lamp._xp_to_level(xp, multiplier, overflow, true)
end
-- Print table
function p._main(args)
return lamp._main(args, true)
end
---- Outward-facing functions
function p.main(frame)
return p._main(frame:getParent().args)
end
function p.xp_to_level(frame)
local args = frame:getParent().args
return p._xp_to_level(args.xp, args.multiplier, args.overflow)
end
function p.level_to_xp(frame)
local args = frame:getParent().args
return p._level_to_xp(args.level, args.multiplier)
end
return p