Post your best Lua script examples here

User avatar
By bradvoy
#6548
jankop wrote:I ran into a problem with the length of the HTML page during testing, . With a longer page server did not work. But with the new Lua (build 20150106) already it works perfectly. It's just a detriment that is not integrated parser for POST request too.


I'm glad you had better results with the newest firmware. There are a few things I'd still like to add to the code, including parsing of POST requests and proper URL-decoding of parameters.
User avatar
By jankop
#6852 Today I met with this problem. Server is rebooted after receiving unintelligible query. I can not judge whether the fault is not in parser.
Code: Select allRequest received:    C   Ů"X„ŐJz
nil     (my comment - it is print(queryString)
PANIC: unprotected error in call to Lua API (httpServer.lua:21: bad argument #1 to 'find' (string expected, got nil))
PANIC: unprotected error in call to Lua API (bad argument #2 (string expected, got no value))
?)Ťý ¶ô@HĚ !ŠôDH
Šô@HŕBCá
NodeMCU 0.9.5 build 20150107  powered by Lua 5.1.4
User avatar
By Hoksmur
#6870 Take a look here.
Now it can detect 404, send html, pht(one string script), lua file; various header for different files without increment requested memory . And more. See sources - 'as is' it isn't work, need run manualy yet: https://github.com/Hoksmur/uLuaNode/issues/1. User function has memory (full-5500) at best.