2 Attachment(s)
HTTP Server and Dynamic Lua Pages
This server can't be used in an actual website of course, but it can be used to learn the basics of HTTP and MooSock and create Web-based interface (Like Google Desktop for example).
It also supports Dynamic Lua Pages - DLP as a webpage scripting language (Similar to PHP).
Known issues:
-Doesn't support binary files
-Can't handle POST requests
-Can't handle more than one request at time (Described in the comments, MooSock crashes. Maybe I did something wrong)
Quick DLP tutorial:
DLP outputs lines with the echo function:
DLP only parses files between <dlp> and </dlp> tags (case sensitive). They MUST be on a line of their own. Tabs and spaces before and after them is allowed:
Code:
<html>This line was sent without DLP<br />
<dlp>
echo('This line was send with DLP');
</dlp>
</html>
GetIP() returns the user's IP:
Code:
echo('Your IP is '..GetIP());
Get parameters are given as GET_param=value;
Code:
echo('The GET parameter name is '..GET_name);
The rest is usual Lua. DLP examples are included.
NOTE: Before running, change the Server Location text to the place your files are hosted.
Re: HTTP Server and Dynamic Lua Pages
The Lua+ object would stop you from having to use those silly workarounds, and increase the performance of the Lua scripts.
Re: HTTP Server and Dynamic Lua Pages
Yeah, but (correct me if I'm wrong) the Lua+ object is still in Beta stage.
Also I didn't have internet connection when I made it and I couldn't download the extension. :(
Re: HTTP Server and Dynamic Lua Pages
Hey, this is rather cool LIJI. Maybe this could be made better with the actual binaries and LuaSocket + some modules for HTML parsing (I have been fiddling around with those, actually).
Re: HTTP Server and Dynamic Lua Pages