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.

Where can I get basic information about .lp files and how to write/use them?

I was very interested by this message and by the two scripts it contains:

As I understand, it is possible to a .lp file stored at the path /www/user/filename.lp by running HTTP request http://<LM_IPadress>/user/filename.lp?parameter1=value1&...&parameterN=valueN.

But there are a lot of things I don't understand:
  • What is exactly a .lp file? What would be the difference with a .lua file?
  • Is there some documentation about the "getvar" function used to get the parameters passed to the HTTP request?
  • If I type http://<LM_IPadress>/user/filename.lp (without any parameter) in my browser, I can't get access to the raw content of the .lp file because it will instead run the file. How can I read the content of the .lp file without executing it?

  • Why does the file has to begin with "<?" and end with "?>", what exactly does this syntax mean and what would be the result if we didn't include these flags?
  • The file proposed in the thread uses 3 libraries: "apps", "dbenv" and "socket.url". Is there a list of all the librairies available (and documentation for each)?
An .lp file is a html file that contains client side LUA and when placed in the user folder you can open this .lp file with the browser

If it contains only html code it would just show as an html page in the browser but when adding client side LUA into the HTML and JS code you get a powerful tool to do really cool stuf like fetching object, alert and storage data from the controller, run queries on the DB, setup a WS to get a stream of changes and the ability to write back to objects and storage.

The <? .. ?> are used to “embed” the LUA code into the HTML and JS code.

require(“apps”) loads lots of needed libs and are documented in the link above from Daniel.

I think dbenv (lib to have acces / run a query on the DB of the controller) is now also included in apps and not needed to specify separately anymore but not 100% sure.

Forum Jump: