Module:Interval ruler

From Xenharmonic Reference
Revision as of 07:58, 29 December 2025 by Vector (talk | contribs) (Created page with "local p = {} function p.e(resolution,intervals,length) length = length or 1200 intervals = intervals or {} i = math.floor(length/1200 * resolution + 0.5) z = {} for k = 0, i do z[k] = "─" end for n = 1, #intervals do z[math.floor(intervals[n]/1200 * resolution + 0.5)] = "┴" end for m = 0, math.floor(i/resolution) do if (z[m*resolution] == "┴") then z[m*resolution] = "┼" else z[m*resolution] = "┬" end end if(z[0]=="┼") then z[0]="├" end if(z[0]=="...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Interval ruler/doc

local p = {}

function p.e(resolution,intervals,length)
length = length or 1200
intervals = intervals or {}

i = math.floor(length/1200 * resolution + 0.5)
z = {}


for k = 0, i do
z[k] = "─"
end



for n = 1, #intervals do
z[math.floor(intervals[n]/1200 * resolution + 0.5)] = "┴"
end

for m = 0, math.floor(i/resolution) do 
if (z[m*resolution] == "┴") then
z[m*resolution] = "┼"
else
z[m*resolution] = "┬"
end end
if(z[0]=="┼") then
z[0]="├"
end
if(z[0]=="┬") then
z[0]="┌"
end
if(z[#z]=="┼") then
z[#z]="┤"
end
if(z[#z]=="┬") then
z[#z]="┐"
end
if(z[#z]=="┴") then
z[#z]="┘"
end
if(z[#z]=="─") then
z[#z]="╮"
end


return table.concat(z,"",0)
end

return p