]> hydra-www.ietfng.org Git - acmetensortoys-esp-lua_lamp/commitdiff
lamp: lua5.0-isms in draw-{candle,staryeyes}
authorNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Wed, 7 Dec 2016 07:52:24 +0000 (02:52 -0500)
committerNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Wed, 7 Dec 2016 07:52:24 +0000 (02:52 -0500)
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.

draw-candle.lua
draw-staryeyes.lua

index 17a2439b594fb1afc9529fc05e19a50675ef039b..37eb65ce5691630a6057e91f9efdce549c41d07d 100644 (file)
@@ -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
index a2b87987afeb9b1b7474ec757d168f98c573a45a..a5443be1f5f8825e707cd55c829b40487a4e7bc2 100644 (file)
@@ -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