22.12.2023, 11:39
Hi,
I have made my first LP page that does stuff dynamically using JavaScript and jQuery, for instance load localbus.js.gz andÂ
but this JavaScript library "localbus" only allows to listen and to write on the values of the KNX objects. What if want to build a jQuery event handler that does something that would be easy to write in Lua? For instance:
I know that I can embed Lua code inside the LP page (with the <? ?> tags), but this Lua code is executed only when loading the page the first time. How would it be possible to execute Lua code on-demand when some event happens on the web page?
I have made my first LP page that does stuff dynamically using JavaScript and jQuery, for instance load localbus.js.gz andÂ
- use localbus.listen() to automatically refresh KNX object values displayed on the page when a KNX object is written
- use localbus.write() to write on a KNX object when some event happens on the page
but this JavaScript library "localbus" only allows to listen and to write on the values of the KNX objects. What if want to build a jQuery event handler that does something that would be easy to write in Lua? For instance:
- enable/disable a script : script.enable, script.disable
- reload the tags of an object : grp.gettags
- read / write a file : io.readfile, io.writefile
- update a scheduler : db:execute("UPDATE scheduler_events SET ... WHERE ...")
...
I know that I can embed Lua code inside the LP page (with the <? ?> tags), but this Lua code is executed only when loading the page the first time. How would it be possible to execute Lua code on-demand when some event happens on the web page?