Module:MOS gamut: Difference between revisions

Ganaram inukshuk (talk | contribs)
Gamut function now accepts the full UDP; this will momentarily break the mos degrees module/template
Ganaram inukshuk (talk | contribs)
Using the pipe character directly has a few issues in the visual editor, so an alternative symbol is advised
Line 123: Line 123:
end
end


-- Helper function for parsing a UDP entered as a string "up|dp"
-- Helper function for parsing a UDP entered as a string "up-dp"
-- To avoid potential issues, the "-" character is used instead of "|"
function p.parse_udp(step_ratio_unparsed)
function p.parse_udp(step_ratio_unparsed)
local parsed = {}
local parsed = {}
for entry in string.gmatch(step_ratio_unparsed, '([^|]+)') do
for entry in string.gmatch(step_ratio_unparsed, '([^-]+)') do
local trimmed = entry:gsub("^%s*(.-)%s*$", "%1")
local trimmed = entry:gsub("^%s*(.-)%s*$", "%1")
table.insert(parsed, trimmed) -- Add to array
table.insert(parsed, trimmed) -- Add to array