Module:Temperature: Difference between revisions
From Stationeers Wiki
More actions
mNo edit summary |
mNo edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
function p. | function p.convert(frame) | ||
local | local raw = frame.args[1] | ||
or (frame.getParent and frame:getParent().args[1]) | |||
or "0" | |||
local k = tonumber(raw) or 0 | |||
local c = k - 273.15 | local c = k - 273.15 | ||
return string.format("%g K (%. | return string.format("%g K (%.1f °C)", k, c) | ||
end | end | ||
return p | return p | ||
Latest revision as of 00:43, 28 August 2025
local p = {} function p.convert(frame)
local raw = frame.args[1]
or (frame.getParent and frame:getParent().args[1])
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