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.

.lp call lua library function
#1
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
Reply
#2
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?
Reply
#3
Thanks,
I have something working now,
If I have some lua lib function with parameters eg

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

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

Many thanks
Reply
#4
You can pass parameters via GET or POST. You can retrieve values via getvar() function in .lp. See complete documentation for more info: https://forum.logicmachine.net/showthread.php?tid=85

jQuery docs on how to send data via POST: https://api.jquery.com/jQuery.post/#jQue...s-dataType
Reply


Forum Jump: