This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

apps/LP page: cleanest way to execute Lua code on jQuery event?
#1
Hi,
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? Huh
Reply


Messages In This Thread
apps/LP page: cleanest way to execute Lua code on jQuery event? - by rbourgeon - 22.12.2023, 11:39

Forum Jump: