Module:MOS intervals: Difference between revisions
m Undo revision 125753 by Ganaram inukshuk (talk) Edited wrong module Tag: Undo |
Rewrite "main" function according to current personal standards |
||
| Line 64: | Line 64: | ||
end | end | ||
function p. | function p.mos_intervals(input_mos, mos_prefix) | ||
-- Default param for input mos is 5L 2s | -- Default param for input mos is 5L 2s | ||
local input_mos = | local input_mos = input_mos or mos.new(2, 5, 2) | ||
local mos_prefix = mos_prefix or "mos" | |||
-- Get the scale sig | |||
local scale_sig = mos.as_string(input_mos) | |||
-- Get the brightest and darkest modes for the mos | -- Get the brightest and darkest modes for the mos | ||
| Line 80: | Line 84: | ||
local steps_per_bright_gen = bright_gen['L'] + bright_gen['s'] | local steps_per_bright_gen = bright_gen['L'] + bright_gen['s'] | ||
local steps_per_dark_gen = steps_per_period - steps_per_bright_gen | local steps_per_dark_gen = steps_per_period - steps_per_bright_gen | ||
-- Create the table, starting with the headers | -- Create the table, starting with the headers | ||
| Line 177: | Line 162: | ||
end | end | ||
result = result .. "|}" | result = result .. "|}" | ||
return result | |||
end | |||
function p.mos_intervals_frame(frame) | |||
-- Get input mos | |||
local input_mos = mos.parse(frame.args['Scale Signature']) | |||
-- Default param for mos prefix | |||
-- If "NONE" is given, no prefix will be used | |||
-- If left blank, try to find the appropriate mos prefix, or else defualt to "mos" | |||
-- If not left blank, use the prefix passed in instead | |||
local mos_prefix = "mos" | |||
if mos_prefix == "NONE" then | |||
mos_prefix = "" | |||
elseif string.len(frame.args['MOS Prefix']) == 0 then | |||
mos_prefix_lookup = p.get_mos_prefix(scale_sig) | |||
if string.len(mos_prefix_lookup) ~= 0 then | |||
mos_prefix = mos_prefix_lookup | |||
end | |||
else | |||
mos_prefix = frame.args['MOS Prefix'] | |||
end | |||
local result = p.mos_intervals(input_mos, mos_prefix) | |||
return result | return result | ||