Module:Sandbox/Erutuon/Temperature difference
< Module:Sandbox | Erutuon
high | 55.6 °F | 56.1 °F | 56.7 °F | 57.7 °F | 60.1 °F | 62.2 °F | 63.4 °F | 64.3 °F | 63.7 °F | 61.7 °F | 58.0 °F | 55.0 °F | 59.6 °F |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
difference | 14.5 °F | 14.4 °F | 14.1 °F | 13.6 °F | 12.6 °F | 12.1 °F | 11.4 °F | 11.5 °F | 13.3 °F | 14.6 °F | 14.5 °F | 14.4 °F | 13.5 °F |
low | 41.1 °F | 41.7 °F | 42.6 °F | 44.1 °F | 47.5 °F | 50.1 °F | 52.0 °F | 52.8 °F | 50.4 °F | 47.1 °F | 43.5 °F | 40.6 °F | 46.1 °F |
function get_numbers(frame)
parameter_1 = frame.args[1]
parameter_2 = frame.args[2]
high = {}
low = {}
for number in parameter_1:gmatch('%-?%d+%.%d') do
table.insert(high, number)
end
for number in parameter_2:gmatch('%-?%d+%.%d') do
table.insert(low, number)
end
return high, low
end
function table_cell(number)
return "\n| " .. number
end
function print_table(frame)
get_numbers(frame)
output = "{| class=\"wikitable nowrap\""
table_row = "\n|-\n! "
output = output .. table_row .. "high"
for i = 1, #high do
output = output .. table_cell(high[i] .. " °F")
end
output = output .. table_row .. "difference"
for i = 1, #high do
output = output .. table_cell(tonumber(high[i]) - tonumber(low[i]) .. " °F")
end
output = output .. table_row .. "low"
for i = 1, #low do
output = output .. table_cell(low[i] .. " °F")
end
output = output .. "\n|}"
return output
end
return { print_table = print_table }