Aller au contenu

jang

Membres confirmés
  • Compteur de contenus

    209
  • Inscription

  • Dernière visite

  • Jours gagnés

    42

Tout ce qui a été posté par jang

  1. jang

    Table Json

    Maybe just collect all the keys starting with "io:" and "core:" ? local function find(expr) local res = {} local function find_aux(expr) if type(expr) == 'table' then if expr[1] then -- array for _,e in ipairs(expr) do find_aux(e) end else -- key/value if expr.name and (expr.name:sub(1,3)=='io:' or expr.name:sub(1,5)=='core:') and expr.value then res[expr.name]=expr.value else for k,v in pairs(expr) do find_aux(v) end end end end end find_aux(expr) return res end keys = find(jsonResponse.devices) print('io:TargetHeatingLevelState=',keys['io:TargetHeatingLevelState']) print('core:RSSILevelState=',keys['core:RSSILevelState']) print('core:LuminanceState=',keys['core:LuminanceState']) print('core:RelativeHumidityState=',keys['core:RelativeHumidityState']) print('core:TemperatureState=',keys['core:TemperatureState']) print('core:ElectricEnergyConsumptionState=',keys['core:ElectricEnergyConsumptionState']) Output [02.12.2022] [23:33:07] [DEBUG] [QUICKAPP1001]: io:TargetHeatingLevelState= eco [02.12.2022] [23:33:07] [DEBUG] [QUICKAPP1001]: core:RSSILevelState= 76.0 [02.12.2022] [23:33:07] [DEBUG] [QUICKAPP1001]: core:LuminanceState= 21 [02.12.2022] [23:33:07] [DEBUG] [QUICKAPP1001]: core:RelativeHumidityState= 49.0 [02.12.2022] [23:33:07] [DEBUG] [QUICKAPP1001]: core:TemperatureState= 20.5 [02.12.2022] [23:33:07] [DEBUG] [QUICKAPP1001]: core:ElectricEnergyConsumptionState= 1748000
  2. jang

    Table Json

    local function find(key,val,list) for _,e in ipairs(list) do if tostring(e[key]):match( then return e end end end print(find('name','io:TargetHeatingLevelState',find('deviceURL','io://0810%-4343%-0200/13610533..',jsonResponse.devices).states).value) You need to quote '-' in the val string ex. '%-' Also, you match any character is with '.' dot, so '..' will match "#1" Is this what you need?
  3. jang

    Table Json

    local function find(key,val,list) for _,e in ipairs(list) do if e[key]==val then return e end end end print(find('name','io:TargetHeatingLevelState',find('deviceURL','io://0810-4343-0200/13610533#1',jsonResponse.devices).states).value)
  4. jang

    Fonction globale/centrale sous HC3

    This kind of works - it's not super efficient but for functions used once in a while it's ok. The library, ex QA with id 1061 function foo(a,b) return a+b end function bar(a,b) return a*b end -------------------------------------------------- function QuickApp:RPC_CALL(path2,var2,n2,fun,args,qaf) local res if qaf then res = {n2,pcall(self[fun],self,table.unpack(args))} else res = {n2,pcall(_G[fun],table.unpack(args))} end api.put(path2,{name=var2, value=res}) end function print() end Then the client QA do -- could be hidden in a separate QA file local var,cid,n = "RPC"..plugin.mainDeviceId,plugin.mainDeviceId,0 local vinit,path = { name=var, value=""},"/plugins/"..cid.."/variables/"..var api.post("/plugins/"..cid.."/variables",{ name=var, value=""}) -- create var if not exist function fibaro._rpc(id,fun,args,timeout,qaf) n = n + 1 api.put(path,vinit) fibaro.call(id,"RPC_CALL",path,var,n,fun,args,qaf) timeout = os.time()+(timeout or 3) while os.time() < timeout do local r,_ = api.get(path) if r and r.value~="" then r = r.value if r[1] == n then if not r[2] then error(r[3],3) else return select(3,table.unpack(r)) end end end end error(string.format("RPC timeout %s:%d",fun,id),3) end function fibaro.rpc(id,name,timeout) return function(...) return fibaro._rpc(id,name,{...},timeout) end end end local foo = fibaro.rpc(1061,'foo') -- create function for remote function in QA 1061 with name foo local bar = fibaro.rpc(1061,'bar') -- create function for remote function in QA 1061 with name bar function QuickApp:onInit() self:debug("onInit") print(foo(2,4)) print(bar(2,4)) end 100 calls to foo(10,29) takes ~3s, so around 0.03s per call...
  5. For a given event it becomes <time to select relevant rule(s)> + <time to execute rule(s)> time-to-execute may be hard to do something about, but If you have a lot of trigger rules, time-to-select will increase, even if the event doesn't trigger any rule at all. It could be optimized by some smart hash-function with the event as the key and possible matching rules as the value, reducing the number of rules needed to be searched through and filtered. Another thing about GEA as I understand it, is that it runs the non-trigger rules every 30s. I guess that every 30s then there is a peak when all rules evaluate their tests - a peak that increase with the number of rules? Here again, and it's a bit more complicated, one could analyze the rule tests when the rules are defined to see what events they depend on. ...and then only invoke the rules that have tests that depends on what events have happened the last 30s. (treating also time as an event...)
  6. -- TEST QA function QuickApp:onInit() self:debug("onInit") end local timer function QuickApp:Cligno_ON() self:setVariable("ClignoRouge", "ON") self.cligno = self:getVariable("ClignoRouge") self:trace("var cligno = "..cligno) if not timer then self:loop() end self:trace("Mise en marche du cligno via le bouton") end function QuickApp:Cligno_OFF() self:setVariable("ClignoRouge", "OFF") self.cligno = self:getVariable("ClignoRouge") self:trace("var cligno = "..cligno) if timer then timer=fibaro.clearTimeout(timer) end self:trace("Mise en arret du cligno via le bouton") end ---------------------------------------------------------- --- Boucle loop ---------------------------------------------------------- function QuickApp:loop() self:trace("loop") hub.sleep(1000) hub.call(79, 'turnOn') hub.sleep(1000) hub.call(79, 'turnOff') timer = fibaro.setTimeout(2000, function() self:loop() end) end
  7. function fibaro.getQAVariable(id,name) __assert_type(id,"number") __assert_type(name,"string") local props = (api.get("/devices/"..id) or {}).properties or {} for _, v in ipairs(props.quickAppVariables or {}) do if v.name==name then return v.value end end end function fibaro.setQAVariable(id,name,value) __assert_type(id,"number") __assert_type(name,"string") return fibaro.call(id,"setVariable",name,value) end function fibaro.getAllQAVariables(id) __assert_type(id,"number") local props = (api.get("/devices/"..id) or {}).properties or {} local res = {} for _, v in ipairs(props.quickAppVariables or {}) do res[v.name]=v.value end return res end Can be used from both Scenes and QuickApps
  8. Your while loop will not give any time for button callbacks to call your Lua functions or update UI i.e. function QuickApp:Cligno_ON() and function QuickApp:Cligno_OFF() You need to use something like setTimeout to give time to your button handlers...
  9. jang

    Déclencheur Event QA HC3

    If you want "sourceTriggers" in your QA you can use https://forum.fibaro.com/topic/62600-detect-keyid-andor-keyattribute-in-a-qa-loop-from-a-device/?do=findComment&amp;comment=255490 Ex. for customEvents function QuickApp:sourceTrigger(event) -- callback for subscribed events print("Event:",event.name) end function QuickApp:onInit() self:debug("Started") self:clearSubscriptions() -- Every restart, re-subscribe self:subscribe({type='custom-event', name='E1'}) -- Subscribe to custom event self:subscribe({type='custom-event', name='E2'}) -- Subscribe to custom event end ----------- Helper functions -------------- function QuickApp:clearSubscriptions() self:setVariable('TRIGGER_SUB',{}) end function QuickApp:subscribe(event) local s = self:getVariable('TRIGGER_SUB') if type(s)~='table' then s = {} end s[#s+1]=event self:setVariable('TRIGGER_SUB',s) end
  10. jang

    tonumber et variable globale

    Sorry, 'time' was not necessary in the last example (cut&paste error...) Another example is json.decode that takes a second optional value in QAs, not in Scenes! They have different implementations. In QAs this will then give an error a = json.decode(fibaro.getGlobalVariable("X")) as json.decode will expect the second argument to be a table with parsing options, and in this case gets the modification time, and will throw an error. Solution, like the last example is a = json.decode((fibaro.getGlobalVariable("X")))
  11. jang

    tonumber et variable globale

    fibaro.getGlobalVariable returns 2 values. String value of variable and time it was last changed. Both these values are then passed to tonumber as arguments The problem is that tonumber can take a second argument, the base for the string->number conversion. In this case it will interpret the change time as the base which is probably out of range. You can throw away all but the first returned value by putting the expression within parentheses. UserIDA = tonumber (( fibaro.getGlobalVariable ( " UserIDA " ))) This will work...
  12. jang

    requette curl en fonction lua

    function QuickApp:pipup() self:debug("envoi du pipup") local data = { duration = "30", position = "2", -- 0 à 4 title = "Test PIPUP", titleColor = "#0066cc", titleSize = "20", message = "Message de Test Pipup", messageColor = "#000000", messageSize = "14", backgroundColor = "#ffffff", media = { image = { uri="https://mir-s3-cdn-cf.behance.net/project_modules/max_1200/cfcc3137009463.5731d08bd66a1.png", width=480 } } } local pipup = net.HTTPClient():request("http://192.168.0.22:7979/notify",{ options = { method = "POST", headers = { ["Content-Type"] = "application/json" }, data = (json.encode(data)) }, success = function(response) self:debug(json.encode(response)) self:debug(json.encode(data)) end, error = function(err) self:error(err) end }) end
  13. jang

    http response

    Don't lose any sleep over the post. The simple take-away was that Fibaro could have let us have both synchronous net.HTTPClient calls and asynchronous setTimeout, that would have made it easier for developers - and that with just a few lines of code. (then to prove it I gave an implementation, but that may be a bit advanced to follow, and put you to sleep )
  14. jang

    http response

    If net.HTTPClient() was synchronous (returning the result immediately) it would have looked like local success,res = net.HTTPClient():request("http://myurl",options) if success then print(res) end a little like in the old HC2 VDs. If the function takes other functions for success/error or callback it's a hint that the function is asynchronous. E.g. will return immediately and later call your functions when it is ready. This is usually much more efficient if you have something else to do while you wait for the work to be completed. ...IF you have something else to do while you wait. Most code in the forums don't and a lot of beginners stumble on this. Fibaro could have let us both have the cake and eat it, however Fibaro is not very "developer friendly". With a few lines of code in the QA we could have had synchronous net.HTTPClient() and asynchronous setTimeout calls. If we wanted "parallel" net.HTTPClient() calls we would just call them in separate setTimeout functions. Just look at the section "Your QA code" in the code below QuickApp = {} ------------- Your QA code ------------ function QuickApp:ping() -- setTimeout loop logging "ping" every second self:debug("ping") setTimeout(function() self:ping() end,1000) end function QuickApp:onInit() self:debug("MyQA") setTimeout(function() self:ping() end,0) -- Start ping loop local success,res = net.HTTPClient():request("http://myurl") -- Run http request and wait for result if success==true then -- If success print result self:debug("Success:",res) end end ------------- End ---------------------- local http = {} net = { HTTPClient = function() return http end } function http:request(url) -- Synchronous http call that respect other timers print("net.HTTPClient: Calling ",url,"-will take 5 seconds") local co = coroutine.running() setTimeout(function() print("net.HTTPClient: ready") coroutine.resume(co,true,"This is the result") -- We always succeed end,5000) return coroutine.yield() end local timers = {} function setTimeout(f,t) table.insert(timers,{coroutine.wrap(f),t/1000+os.time()}) table.sort(timers,function(a,b) return a[2] <= b[2] end) end if QuickApp.onInit then function QuickApp:debug(...) print(os.date("%c"),...) end setTimeout(function() QuickApp:onInit() end,0) end while true do local t = table.remove(timers,1) while t[2] > os.time() do end t[1]() end It will run the "ping" loop while the net.HTTPClient() call waits for its result. We can write much more "natural" code and everyone would be more happy, and we would see less buggy code... However, it doesn't work on the HC3 as Fibaro in its infinite wisdom has decided to disable coroutines that is one of the biggest features of Lua. (You can try to run the example in any other "full" Lua environment to see it in action...) 'coroutines', in short, allow us to suspend execution of the code in the middle of your function (yield) and then later "wake up" the function so that it continues to run from where it was suspended (resume). In our code we let setTimeout wrap the function in a coroutine so that the function can be suspended and resumed. In the case above we suspend the net.HTTPClient() call, and then when it's ready (5s later) we wake it up so the function can return the result to the waiting caller. local success,res = net.HTTPClient():request("http://myurl") So, Lua is a very powerful language but we are unfortunately only allowed to use a small part of it...
  15. jang

    http response

    local id = resp[1].nukiId
  16. jang

    Camera REOLINK sur HC3 (& HC2)

    The problem you have running several 'setAudioAlarm' in parallel is that you store values in self. that is shared between all calls to 'setAudioAlarm'. It could work better if you sent them as parameters to the call, so each call had it's own version of the parameters. Running them with a random delay is like playing the lottery... where the prize is a buggy program. You still have the problem with nesting calls in request callbacks. Each event has it's own set of parameters in the .p key. The advantage of sending user/pwd with each event is that cameras can have different credentials. If not we could have used self.use and self.pwd instead in 'setAudioAlarm'. I also don't understand the enable/toggle logic. I guess you want to alternate between turning on and turning off the camera? To make it correct you should first read the enable state with a call and then set it to the opposite with another call. Otherwise you may get out of sync... So, first call checkSiren, set the p.enable to the opposite and call changeSirenToggle You could also have 2 buttons, turnOn and turnOff and send the enable state 1/0 with them (like I tried in turnOn, should enable be 1 or 0 ?) Btw, I put the QuickApp:turnOn function in the same QA as the rest of the code (using local 'post' function). Maybe you wanted to do it from another QA? I would have coded it this way, using the model of events. This way you avoid the nesting. It may be a bit advanced, but worth studying if you have trouble sleeping Disclaimer: I don't have access to a Reolink camera so I really don't know what I'm doing local testing = true -- simulate api calls local post function QuickApp:turnOn() self:debug( "binary switch turned on" ) self:updateProperty( "value" , true ) post({type='setAudioAlarm',p={camera="192.168.1.46", tool="1",user=self.user,pwd=self.pwd,enable=1}}) -- 'p' stands for 'parameters' post({type='setAudioAlarm',p={camera="192.168.1.48", tool="1",user=self.user,pwd=self.pwd,enable=1}}) -- should enable be 1 ? post({type='setAudioAlarm',p={camera="192.168.1.45", tool="1",user=self.user,pwd=self.pwd,enable=1}}) end function QuickApp:turnOff() self:debug( "binary switch turned off" ) self:updateProperty( "value" , false ) post({type='setAudioAlarm',p={camera="192.168.1.46", tool="1",user=self.user,pwd=self.pwd,enable=0}}) post({type='setAudioAlarm',p={camera="192.168.1.48", tool="1",user=self.user,pwd=self.pwd,enable=0}}) post({type='setAudioAlarm',p={camera="192.168.1.45", tool="1",user=self.user,pwd=self.pwd,enable=0}}) end local debug = true local EVENT={} local function DEBUG(...) if debug then print(...) end end function post(event) setTimeout(function() assert(EVENT[tostring(event.type)],"Undefined event ",tostring(event.type)) DEBUG("Event:",event.type) EVENT[event.type](event) end,0) end -------------------------------------------------- -------------------------------------------------- -- senCmd -------------------------------------------------- -------------------------------------------------- local function sendCmd(event,method,cmd,data) local url = "https://"..event.p.camera..":443/api.cgi?cmd="..cmd self.http:request(url,{ options = { checkCertificate= false , method= method or "GET" , headers = { [ "content-type" ] = "application/json" , [ "Accept" ] = "application/json" , }, data = data and json.encode(data) or nil }, success = function(resp) if resp.status == 200 then DEBUG("success ",url,resp.data) post({type=event.type.."_success",p=event.p,url=url,data=json.decode(resp.data)}) else post({type=event.type.."_error",p=event.p,url=url,error="status="..resp.status}) end end, error = function(err) post({type=event.type.."_error",p=event.p,url=url,error=err}) end } ) end if testing then -- redefine sendCmd for test purpose when no access to Relink function sendCmd(event,method,path,data) local data = {} if path:match("Login") then data = {{value={Token={name="myToken"}}}} elseif path:match("GetAudioAlarmV20") then data = {{value={Audio={enable=0}}}} end DEBUG("success ","https://"..event.p.camera..":443/api.cgi?cmd="..path,json.encode(data)) post({type=event.type.."_success",p=event.p,url=url,data=data}) end end -------------------------------------------------- -------------------------------------------------- -- connection to the camera and recovery of the token, if ok call ChangeSirenToggle -------------------------------------------------- -------------------------------------------------- function EVENT.setAudioAlarm(event) sendCmd(event,"POST","Login", { [ 'cmd' ]= "Login" , [ 'param' ]={ [ 'User' ]={ [ 'userName' ]=event.p.user, [ 'password' ]=event.p.pwd } } } ) end local function add(t,a) for k,v in pairs(a) do t[k]=v end return t end function EVENT.setAudioAlarm_success(event) local token = event.data[ 1 ][ "value" ][ "Token" ][ "name" ] -- login token DEBUG( "Camera(): Connected" ) -- Call to change the siren parameter post({type='ChangeSirenToggle',p=add(event.p,{token=token})}) end function EVENT.setAudioAlarm_error(event) quickApp:error( "Identification problem - Error - " , json.encode(event.error,event.url or "")) end -------------------------------------------------- -------------------------------------------------- -- Change siren parameter -------------------------------------------------- -------------------------------------------------- function EVENT.ChangeSirenToggle(event) sendCmd(event,"POST","SetAudioAlarmV20&token="..event.p.token, { [ 'cmd' ]= "SetAudioAlarmV20" , [ 'param' ]= { [ 'Audio' ]= { [ 'enable' ]= event.p.enable, [ 'schedule' ]= { [ 'channel' ]= 0 , [ 'table' ]= { [ 'MD' ]= string.rep("1",168) } } } } } ) end function EVENT.ChangeSirenToggle_success(event) post({type='checkSiren',p=event.p}) --- print siren value after update end function EVENT.ChangeSirenToggle_error(event) quickApp:updateView( "message" , "Title" , "Identification problem" ..json.encode(event.error)) quickApp:error( "Problem updating Siren parameter - Error - " , json.encode(event.error)) end --------------------------- -- Check the siren parameter value ---------------------------- function EVENT.checkSiren(event) sendCmd(event,"GET","GetAudioAlarmV20&token=" ..event.p.token, { [ 'cmd' ]= "GetAudioAlarmV20" , [ 'param' ]= { [ 'channel' ]= 0 } } ) end function EVENT.checkSiren_success(event) local siren=event.data[ 1 ][ "value" ][ "Audio" ][ "enable" ] print(event.p.camera.. "'s siren is on" , siren) post({type='logout',p=event.p}) --(self.camera, self.token) end function EVENT.checkSiren_error(event) quickApp:error( "Problem updating Siren parameter - Error - " , json.encode(event.error)) --self:logout(self.camera, self.enable) post({type='logout',p=event.p}) end -------------------------------------------------- -------------------------------------------------- -- Logout -------------------------------------------------- -------------------------------------------------- function EVENT.logout(event) sendCmd(event,"POST","Logout&token=" ..event.p.token, { [ 'cmd' ]= "Logout" , [ 'param' ]= {} } ) end function EVENT.logout_success(event) print( "Logout from " ..event.p.camera.. " done" ) end function EVENT.logout_error(event) quickApp:error( "Problem logging out - " , json.encode(event.error)) end -------------------------------------------------- -------------------------------------------------- -------------------- -- main loop -------------------------------------------------- -------------------------------------------------- -------------------- function QuickApp:mainLoop() -- self:logout(self.camera, self.enable) --self:setAudioAlarm(self.camera, self.enable) end -------------------------------------------------- -------------------------------------------------- ----------------- -- -------------------------------------------------- -------------------------------------------------- ----------------- function QuickApp:onInit() __TAG="QA_Reolink"..plugin.mainDeviceId self:trace( "------------------------------------------------------------ -----" ) self:trace( "-- Starting Reolink QA" ) self:trace( "------------------------------------------------------------ -----" ) --- login self.user = self:getVariable( "login" ) ---password self.pwd = self:getVariable( "password" ) --- IP URL -- self.camera = self:getVariable( "IP_Reolink" ) self.http = net.HTTPClient({ timeout = 3000 }) -- Toggle -- self.enable = 0 -- self:mainLoop() if testing then setTimeout(function() self:turnOn() end,1) end -- Just testing to push button... end
  17. a = 1 b = 24 print(a << 8 | b) > 280
  18. Ok, I have seen those errors too, despite the protective code. Maybe protect the net.HTTPClient():request(...) call too? and maybe the QuickApp:onInit().... ...just thinking out loud.
  19. What is your QA doing? HTTP calls?
  20. Normally I would tend to agree with you. (actually to be more philosophical, the problem is when people by-pass functions and rewrite what they are doing (example). Here we just wrap an existing function and honour the existing contract - we still call the original HTTPClient etc. The only problem is if the function goes away - but that is the same problem for the rest of your code). However, these functions have been around since the beginning and are essential for most QAs out there. I would really doubt that they are going to deprecate them. In fact, I argue that the patched functions now works as they should have in the first place. This is such an easy fix that Fibaro should have done it themselves when the HC3 came out. Instead there are 100s of posts in the forum by users that complains about QAs crashes without any error message, and blame the HC3... and Fibaro puts up with it... I don't understand how that company is run.... The easiest and cheapest customer support is to have good error messages... I see that I used fibaro.* instead of hub.* - but today they both point to the same function table - also here I doubt thet they would remove fibaro.* as too many QAs would stop working.
  21. The idea with protecting json.encode/decode was to get an error line pointing to where json.encode was called from in user code, and not an error pointing deep into the json library - which is seldom helpful. setTimeout and setInterval will not log an error if the function crashes. This prints out the error.
  22. Instead of do : end do local debug = true if debug then : end and set it to false when you found the bug
  23. Forgot a 'copy' function in original post - added.
  24. Remove your pcalls and add this as a separate file in your QA do local function perror(...) fibaro.error(__TAG,...) end function copy(obj) if type(obj) == 'table' then local res = {} for k,v in pairs(obj) do res[k] = copy(v) end return res else return obj end end local httpClient = net.HTTPClient -- protect success/error with pcall and print error function net.HTTPClient(args) local http = httpClient() return { request = function(_,url,opts) opts = copy(opts) local success,err = opts.success,opts.error if opts then opts.timeout = opts.timeout or args and args.timeout end if success then opts.success=function(res) local stat,r=pcall(success,res) if not stat then perror(r) end end end if err then opts.error=function(res) local stat,r=pcall(err,res) if not stat then perror(r) end end end return http:request(url,opts) end } end local settimeout, setinterval, encode, decode = -- gives us a better error messages setTimeout, setInterval, json.encode, json.decode function setTimeout(fun,ms) return settimeout(function() local stat,res = pcall(fun) if not stat then perror(res) end end,ms) end fibaro.setTimeout = function(ms,fun) return setTimeout(fun,ms) end function setInterval(fun,ms) return setinterval(function() local stat,res = pcall(fun) if not stat then perror(res) end end,ms) end fibaro.setInterval = function(ms,fun) return setInterval(fun,ms) end function json.decode(...) local stat,res = pcall(decode,...) if not stat then error(res,2) else return res end end function json.encode(...) local stat,res = pcall(encode,...) if not stat then error(res,2) else return res end end end do local function perror(...) fibaro.error(__TAG,...) end local httpClient = net.HTTPClient -- protect success/error with pcall and print error function net.HTTPClient(args) local http = httpClient() return { request = function(_,url,opts) opts = copy(opts) local success,err = opts.success,opts.error if opts then opts.timeout = opts.timeout or args and args.timeout end if success then opts.success=function(res) local stat,r=pcall(success,res) if not stat then perror(r) end end end if err then opts.error=function(res) local stat,r=pcall(err,res) if not stat then perror(r) end end end return http:request(url,opts) end } end local settimeout, setinterval, encode, decode = -- gives us a better error messages setTimeout, setInterval, json.encode, json.decode function setTimeout(fun,ms) return settimeout(function() local stat,res = pcall(fun) if not stat then perror(res) end end,ms) end fibaro.setTimeout = function(ms,fun) return setTimeout(fun,ms) end function setInterval(fun,ms) return setinterval(function() local stat,res = pcall(fun) if not stat then perror(res) end end,ms) end fibaro.setInterval = function(ms,fun) return setInterval(fun,ms) end function json.decode(...) local stat,res = pcall(decode,...) if not stat then error(res,2) else return res end end function json.encode(...) local stat,res = pcall(encode,...) if not stat then error(res,2) else return res end end end
  25. 1. hub.call(175, "updateView","label", "text", "Good day")
×
×
  • Créer...