From 635241637cac837fdbc3dd1ef9d52baedeedc1a2 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Tue, 7 Nov 2017 18:29:32 -0500 Subject: [PATCH] touch: sort drawings by name for selection --- lamp-touch.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lamp-touch.lua b/lamp-touch.lua index 5aac3f3..313faac 100644 --- a/lamp-touch.lua +++ b/lamp-touch.lua @@ -18,11 +18,10 @@ if touchlastfn == nil then touchlastfn = "fill" end local k,v for k,v in pairs(file.list()) do local ix, _, meth = k:find("^draw%-(%w+)%.lc$") - if ix then - touchfns[#touchfns+1] = meth - if meth == touchlastfn then touchfnix = #touchfns end - end + if ix then touchfns[#touchfns+1] = meth end end +table.sort(touchfns) +for k,v in ipairs(touchfns) do if v == touchlastfn then touchfnix = k end end local function claimfb() if ledfb_claimed == 0 then -- 2.50.1