diff --git a/UserManual.md b/UserManual.md index e2006a1e..f69398b6 100644 --- a/UserManual.md +++ b/UserManual.md @@ -307,8 +307,9 @@ like request method, all headers, etcetera. Please refer to `struct mg_request_info` definition in [mongoose.h](https://github.com/valenok/mongoose/blob/master/mongoose.h) to see what kind of information is present in `request_info` object. Also, -[page.lp](https://github.com/valenok/mongoose/blob/master/test/page.lp) -contains some example code that uses `request_info`. +[page.lp](https://github.com/valenok/mongoose/blob/master/test/page.lp) and +[prime_numbers.lp]()https://github.com/valenok/mongoose/blob/master/examples/lua/prime_numbers.lp +contains some example code that uses `request_info` and other functions(form submitting for example). One substantial difference of mongoose's Lua Pages and PHP is that Mongoose @@ -323,6 +324,11 @@ It is easy to do things like redirects, for example: +To serve Lua Page, mongoose creates Lua context. That context is used for +all Lua blocks within the page. That means, all Lua blocks on the same page +share the same context. If one block defines a variable, for example, that +variable is visible in the block that follows. + # Common Problems - PHP doesn't work - getting empty page, or 'File not found' error. The reason for that is wrong paths to the interpreter. Remember that with PHP, diff --git a/examples/lua/prime_numbers.lp b/examples/lua/prime_numbers.lp new file mode 100644 index 00000000..b3edc129 --- /dev/null +++ b/examples/lua/prime_numbers.lp @@ -0,0 +1,42 @@ + + + +

Prime numbers from 0 to 100, calculated by Lua:

+ ' .. i .. ' ') end + end + + ?> + +

Reading POST data from Lua (click submit):

+
+ +
+   POST data: []
+   request method: []
+   IP/port: []
+   URI: []
+   HTTP version []
+   HEADERS:
+   
+
+