hi,
just started with Lua programming and i wanted to display a track-list and instrument-list in my tool. that was working fine, but i wanted it to display the way it does in the hydra (etc) popup/dropdown menus, so instead of
Track01
Kick
Snare
Track03
i wanted
01: Track01
02: Kick
03: Snare
04: Track03
the track-indexes obviously don’t have a appended 0, but just give you ‘1’ for Track01. so, i wrote a tiny function to do that. i figured others might want to use such a thing, so here it is.
-- custom function to append a zero to a number below 10
function append_zero(value)
if value < 10 then
value = "0"..value
end
return value
end