Module:Utils: Difference between revisions

Fredg999 (talk | contribs)
Trying to make eval_num_arg recognize fractions
Fredg999 (talk | contribs)
Bug fixing
Line 8: Line 8:
result = def_value
result = def_value
if type(input) == 'string' then
if type(input) == 'string' then
input = input:match("^%s*(.-)/(.-)%s*$")
local denominator
input, denominator = input:match("^%s*(.-)/(.-)%s*$")
if string.len(input) > 0 then
if string.len(input) > 0 then
result = tonumber(input)
result = tonumber(input/denominator)
end
end
end
end