From: Nathaniel Wesley Filardo Date: Wed, 7 Dec 2016 07:52:24 +0000 (-0500) Subject: lamp: lua5.0-isms in draw-{candle,staryeyes} X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=e68e815afc325193c03ea6517e45ebcf5e6990b0;p=acmetensortoys-esp-lua_lamp lamp: lua5.0-isms in draw-{candle,staryeyes} In particular, the use of the function-local "arg" is deprecated and gone entirely in lua5.2. Switch to "ipairs{...}" rather than "ipairs(arg)" which should work with both nodemcu and host programs. --- diff --git a/draw-candle.lua b/draw-candle.lua index 17a2439..37eb65c 100644 --- a/draw-candle.lua +++ b/draw-candle.lua @@ -25,7 +25,7 @@ return function(t,fb,g,r,b) local ag = adjust(g,bias) local ar = adjust(r,bias) local ab = adjust(b,bias) - for i,v in ipairs(arg) do fb:set(v,ag,ar,ab) end + for i,v in ipairs{...} do fb:set(v,ag,ar,ab) end end -- flame (f) behaviors: equal intensity, dimmer top, dimmer left, and dimmer right diff --git a/draw-staryeyes.lua b/draw-staryeyes.lua index a2b8798..a5443be 100644 --- a/draw-staryeyes.lua +++ b/draw-staryeyes.lua @@ -12,7 +12,7 @@ return function(t,fb,g,r,b) local ag = adjust(g,bias) local ar = adjust(r,bias) local ab = adjust(b,bias) - for i,v in ipairs(arg) do fb:set(v,ag,ar,ab) end + for i,v in ipairs{...} do fb:set(v,ag,ar,ab) end end local function drawEq() for i,v in ipairs({3,6}) do fb:set(v,g,r,b) end end @@ -28,4 +28,4 @@ return function(t,fb,g,r,b) ft[math.random(#ft)]() dodraw() end) -end \ No newline at end of file +end