Module:ET sort key: Difference between revisions
Created page with "local getArgs = require("Module:Arguments").getArgs local ET = require("Module:ET") local p = {} -- return a string of #'s corresponding to the size (#notes/equave) of the ET function p.et_sort_key(frame) local args = getArgs(frame) return p._et_sort_key(args[0]) end function p._et_sort_key(tuning) local et = ET.parse(tuning) local size = et.size local sort_key = String.rep("#", size:count("%d")) return sort_key end" |
Bugfix |
||
(4 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
function p.et_sort_key(frame) | function p.et_sort_key(frame) | ||
local args = getArgs(frame) | local args = getArgs(frame) | ||
return p._et_sort_key(args[ | return p._et_sort_key(args[1]) | ||
end | end | ||
function p._et_sort_key(tuning) | function p._et_sort_key(tuning) | ||
local et = ET.parse(tuning) | local et = ET.parse(tuning) | ||
local size = et.size | local size = tostring(et.size) | ||
local sort_key = | local sort_key = string.rep("#", size:len()) | ||
return sort_key | return sort_key | ||
end | end | ||
return p |