Module:MOS: Difference between revisions

Inthar (talk | contribs)
mNo edit summary
Ganaram inukshuk (talk | contribs)
Added variant function of as_string, which formats a mos string as "xL ys (p/q-equivalent)"
Line 126: Line 126:
if not rat.eq(mos.equave, 2) then
if not rat.eq(mos.equave, 2) then
suffix = '⟨' .. rat.as_ratio(mos.equave):lower() .. '⟩'
suffix = '⟨' .. rat.as_ratio(mos.equave):lower() .. '⟩'
end
return '' .. mos.nL .. 'L ' .. mos.ns .. 's' .. suffix
end
-- construct a long string representation for a MOS structure
function p.as_long_string(mos)
local suffix = ''
if not rat.eq(mos.equave, 2) then
suffix = string.format(" (%s-equivalent)", rat.as_ratio(mos.equave):lower())
end
end
return '' .. mos.nL .. 'L ' .. mos.ns .. 's' .. suffix
return '' .. mos.nL .. 'L ' .. mos.ns .. 's' .. suffix