Module:MOS: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
mNo edit summary |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
-- This module follows User:Ganaram inukshuk/Provisional style guide for Lua | -- This module follows [[User:Ganaram inukshuk/Provisional style guide for Lua]] | ||
local et = require("Module:ET") | |||
local rat = require("Module:Rational") | |||
local utils = require("Module:Utils") | |||
local p = {} | local p = {} | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
| Line 40: | Line 23: | ||
-- If no equave "p/q" is provided, it's assumed to be 2/1-equivalent. | -- If no equave "p/q" is provided, it's assumed to be 2/1-equivalent. | ||
function p.parse(unparsed) | function p.parse(unparsed) | ||
local nL, ns, equave = unparsed:match("^(%d+)[Ll] | local nL, ns, equave = unparsed:match("^(%d+)[Ll].-(%d+)[Ss]%s*(.*)$") | ||
nL = tonumber(nL) | nL = tonumber(nL) | ||
ns = tonumber(ns) | ns = tonumber(ns) | ||
| Line 307: | Line 290: | ||
local current_mode = mode_string | local current_mode = mode_string | ||
for i = 1, #mode_string do | for i = 1, #mode_string do | ||
if not | if not utils.table_contains(rotations, current_mode) then | ||
table.insert(rotations, current_mode) | table.insert(rotations, current_mode) | ||
end | end | ||