optimization
optimization

file:a/mqtt.lua -> file:b/mqtt.lua
--- a/mqtt.lua
+++ b/mqtt.lua
@@ -59,14 +59,14 @@
         mqtt:publish(prefix .. device .. "/toggle2/status", "{\"status\":" .. status2 .. "}", 1, 1, function(conn)
         end)
     else
-        local list = {} 
+        local list = {}
         local k = 0
         for v in string.gmatch(topic, "([^/]+)") do
             list[k] = v
             k = k + 1
         end
         local id = list[1]
-        msg = cjson.decode(data)
+        local msg = cjson.decode(data)
         print('\tNew request from IoT Manager: id="' .. id .. '", command="' .. msg.command .. '", param="' .. msg.param .. '"');
 
         if msg.command == "getPages" then

comments