Module:JI ratios: Difference between revisions
mNo edit summary |
Added ratio-parsing function |
||
| Line 211: | Line 211: | ||
return sorted_ratios | return sorted_ratios | ||
end | |||
-------------------------------------------------------------------------------- | |||
------------------------ RATIO PARSING/INPUT FUNCTIONS ------------------------- | |||
-------------------------------------------------------------------------------- | |||
-- Parse a list of ratios from a string. String is formatted as follows: | |||
-- "a/b; c/d; e/f; g/h" | |||
function p.parse_ratios(unparsed) | |||
local parsed = tip.parse_numeric_pairs(unparsed) | |||
for i = 1, #parsed do | |||
parsed[i] = rat.new(parsed[i][1], parsed[i][2]) | |||
end | |||
return parsed | |||
end | end | ||