Hi Thijs, I must correct myself about my remark regarding global variables: yes they are there, but indeed you must manage them by hand as you state. Btw: you should upgrade the HC2 to the latest firmware. Better, still not perfect. :-) Regards, Erwin -----Oorspronkelijk bericht----- Van: zerobrane-bounce@xxxxxxxxxxxxx [mailto:zerobrane-bounce@xxxxxxxxxxxxx] Namens Thijs Schreijer Verzonden: dinsdag 10 februari 2015 17:31 Aan: zerobrane@xxxxxxxxxxxxx Onderwerp: [ZeroBrane Studio] Re: Feature request: Fibaro Lua support > -----Original Message----- > From: zerobrane-bounce@xxxxxxxxxxxxx > [mailto:zerobrane-bounce@xxxxxxxxxxxxx] > On Behalf Of Paul K > Sent: maandag 9 februari 2015 0:21 > To: zerobrane@xxxxxxxxxxxxx > Subject: [ZeroBrane Studio] Re: Feature request: Fibaro Lua support > > Hi Thijs, > > > You'd need a Home Center 2 device as the Light version doesn't have > > Lua > scripting support (600 euro). > Thank you for the details; I wasn't aware of that and was checking HC > Lite devices as they seem to be noticeably cheaper. > > > btw. It's probably one of the worst Lua implementations I've ever > > seen > Any further details? They seem to be using Lua 5.2, but I don't have > any more information. > > Paul. One has to create "Virtual devices" to run Lua code. You can add controls to each device, with event handler code attached to that. Besides that, the device has a "main loop" concept, which just re-runs the main-loop code once every second. Horrible performance. There is no shared environment. So each piece of event handler code, has its own environment. (not even shared with the main loop thing) There only is some sort of global table of shared data, but it can only contain numbers. So that is all there is to communicate between the pieces of code within the same device (and worse, you cannot create those from code, only set and read them, the user has to manually create them). I think I even wrote some code to communicate through the id-number of an icon set somewhere. The api is based on string contents, eg. `fibaro.call("my func name", 1, 2, 3)` or something similar. Dunno who designed it, but he/she had clearly no experience with Lua whatsoever. See https://github.com/Tieske/fibaroHue Thijs PS. If anyone still feels like wanting to own a Home Center 2, I have one lying around unused. I'll give you a 150 euro discount :)