Still landing on the old Fandom wiki? Install the HighSpell Wiki Redirector browser extension to automatically redirect all highspell.fandom.com links to highspell.wiki. Works on both Firefox and Chrome, and is open-source. → Learn more and install it now!

Module:Ticks: Difference between revisions

From HighSpell Wiki
Jump to navigation Jump to search
Created page with "local p = {} function p.display(frame) local args = frame:getParent().args local amount = tonumber(args["amount"]) or 0 local seconds = amount * 0.6 local roundedSeconds = math.floor(seconds + 0.5) -- round to nearest whole number return string.format("%d Ticks (%ds)", amount, roundedSeconds) end return p"
 
No edit summary
(One intermediate revision by the same user not shown)
Line 3: Line 3:
function p.display(frame)
function p.display(frame)
     local args = frame:getParent().args
     local args = frame:getParent().args
     local amount = tonumber(args["amount"]) or 0
     local amount = tonumber(args[1] or args["amount"]) or 0
     local seconds = amount * 0.6
     local seconds = amount * 0.6
     local roundedSeconds = math.floor(seconds + 0.5) -- round to nearest whole number
     local roundedSeconds = math.floor(seconds + 0.5)
     return string.format("%d [[Ticks]] (%ds)", amount, roundedSeconds)
 
    local timeDisplay = string.format('<abbr title="Time in seconds">%ds</abbr>', roundedSeconds)
 
     return string.format("%d [[Ticks]] (%s)", amount, timeDisplay)
end
end


return p
return p

Revision as of 22:33, 17 May 2025

Documentation for this module may be created at Module:Ticks/doc

local p = {}

function p.display(frame)
    local args = frame:getParent().args
    local amount = tonumber(args[1] or args["amount"]) or 0
    local seconds = amount * 0.6
    local roundedSeconds = math.floor(seconds + 0.5)

    local timeDisplay = string.format('<abbr title="Time in seconds">%ds</abbr>', roundedSeconds)

    return string.format("%d [[Ticks]] (%s)", amount, timeDisplay)
end

return p