From: Nathaniel Wesley Filardo Date: Tue, 7 Nov 2017 23:29:32 +0000 (-0500) Subject: touch: sort drawings by name for selection X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=635241637cac837fdbc3dd1ef9d52baedeedc1a2;p=acmetensortoys-esp-lua_lamp touch: sort drawings by name for selection --- 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