Module:Ups and downs notation: Difference between revisions

CompactStar (talk | contribs)
No edit summary
CompactStar (talk | contribs)
No edit summary
Line 1: Line 1:
local ET = require("Module:ET")
local ET = require("Module:ET")
-- local u = require("Module:Utils")
local u = require("Module:Utils")
local p = {}
local p = {}


local function table_contains(tbl, x)
    found = false
    for _, v in pairs(tbl) do
        if v == x then
            found = true
        end
    end
    return found
end




Line 74: Line 64:
-- Add sharp/up notes
-- Add sharp/up notes
for i = 0,et.size-1 do
for i = 0,et.size-1 do
if table_contains(major_note_idx, i) then
if u.table_contains(major_note_idx, i) then
last_major_note = i
last_major_note = i
else
else
Line 100: Line 90:
-- Add flat/down notes
-- Add flat/down notes
for i = et.size-1,0,-1 do
for i = et.size-1,0,-1 do
if table_contains(major_note_idx, i) then
if u.table_contains(major_note_idx, i) then
last_major_note = i
last_major_note = i
else
else