Module:MOS: Difference between revisions
Bugfixed interval_as_string for zero-counts |
m moar bugfixes to interval-as-string |
||
| Line 95: | Line 95: | ||
-- where i and j are the quantities for L and s. | -- where i and j are the quantities for L and s. | ||
function p.interval_as_string(interval) | function p.interval_as_string(interval) | ||
-- Quantity of L's as a string | -- Quantity of L's as a string | ||
local L_string = "" | |||
if interval['L'] == 0 then | if interval['L'] == 0 then | ||
L_string = "" | L_string = "" | ||
| Line 108: | Line 107: | ||
-- Quantity of s's as a string | -- Quantity of s's as a string | ||
local s_string = "" | |||
if math.abs(interval['s']) == 0 then | if math.abs(interval['s']) == 0 then | ||
s_string = "" | |||
elseif math.abs(interval['s']) == 1 then | elseif math.abs(interval['s']) == 1 then | ||
s_string = "s" | |||
else | else | ||
s_string = string.format("%ds", math.abs(interval['s'])) | |||
end | end | ||
if | if interval['L'] == 0 and interval['s'] == 0 then | ||
return "0" | return "0" | ||
elseif | elseif interval['L'] == 0 and interval['s'] ~= 0 then | ||
return L_string | return L_string | ||
elseif | elseif interval['L'] ~= 0 and interval['s'] == 0 then | ||
return s_string | return s_string | ||
else | else | ||