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 whether you accept or reject these cookies being set.

.lp call lua library function
Is it possible to call a lua library function from custom javascript using a .lp file, i know we can retrieve data from the .lp script

many Thanks
You can call any function but you need to make sure that there are no blocking call because that will block the web server until function is executed. .lp can be loaded via XHR/AJAX call. What kind of function do you want to execute?
I have something working now,
If I have some lua lib function with parameters eg

function do_cmd(cmd)
return(“MV”.. cmd)

Can the parameter cmd be passed through the .lp
From the js Or do I need separate .lp for each function call?

Many thanks
You can pass parameters via GET or POST. You can retrieve values via getvar() function in .lp. See complete documentation for more info:

jQuery docs on how to send data via POST:

Forum Jump: