Module:Infobox chord: Difference between revisions

Bcmills (talk | contribs)
No edit summary
Bcmills (talk | contribs)
No edit summary
Line 39: Line 39:
if utils.value_provided(frame.args["Harmonics"]) then
if utils.value_provided(frame.args["Harmonics"]) then
local harmonics = {}
local harmonics = {}
local i = 0
for hs in string.gmatch(frame.args["Harmonics"], "[^:]+") do
for hs in string.gmatch(frame.args["Harmonics"], "[^:]+") do
debug_data = debug_data .. "hs:" .. hs .. "<br/>"
debug_data = debug_data .. "hs:" .. hs .. "<br/>"
Line 46: Line 45:
errors = errors .. "<p>error: invalid harmonic " .. hs .. "</p>"
errors = errors .. "<p>error: invalid harmonic " .. hs .. "</p>"
else
else
harmonics[i] = h
table.insert(harmonics, h)
i = i+1
end
end
end
end
local root = harmonics[0]
local root = harmonics[1]
if root == nil and errors == "" then
if root == nil and errors == "" then
errors = errors .. "<p>error: no harmonics found</p>"
errors = errors .. "<p>error: no harmonics found</p>"