Anonymous user
Module:Convert: Difference between revisions
fix valid_number check to account for Scribunto using 'nan' or 'inf' for problem numbers
(allow conversion between different unit types for certain whitelisted exceptions (torque/energy); emulate MediaWiki's template handling by accepting and multiple spaces in a unit name) |
(fix valid_number check to account for Scribunto using 'nan' or 'inf' for problem numbers) |
||
Line 639:
local function valid_number(num)
-- Return true if num is a valid number.
-- In Scribunto (different from some standard Lua), when expressed as a string,
-- overflow or other problems are indicated with text like "
-- which are regarded as invalid here (each contains "n").
if type(num) == 'number' and tostring(num):find('
return true
end
|