Module:Temperature: Difference between revisions
From Stationeers Community Wiki
More actions
No edit summary |
mNo edit summary |
||
| Line 2: | Line 2: | ||
function p.convert(frame) | function p.convert(frame) | ||
local raw = frame.args[1] or frame.args.Temperature | local raw = frame.args[1] or frame.args.Temperature | ||
or (frame.getParent and frame:getParent().args[1]) | or (frame.getParent and frame:getParent().args[1] or frame:getParent().args.Temperature) | ||
or "0" | or "0" | ||
local k = tonumber(raw) or 0 | local k = tonumber(raw) or 0 | ||
Latest revision as of 20:49, 15 March 2026
Documentation for this module may be created at Module:Temperature/doc
local p = {}
function p.convert(frame)
local raw = frame.args[1] or frame.args.Temperature
or (frame.getParent and frame:getParent().args[1] or frame:getParent().args.Temperature)
or "0"
local k = tonumber(raw) or 0
local c = k - 273.15
return string.format("%g K (%.1f °C)", k, c)
end
return p