Post your best Lua script examples here

User avatar
By Elimathew
#57380 I am learning lua examples of nodemcu after which I have some doubts
1] if I create 4 .lua filles and send them to esp2866 do I need to compile(node.compile()) them I have seen people compiling the lua file isn't lua an interpreter

2] if I need to compile does the esp2866 have a compiler inbuilt ?

3]if I send the .lua files randomly how does the esp2866 know which is the first instruction to be executed
User avatar
By darethehair
#57399
Elimathew wrote:I am learning lua examples of nodemcu after which I have some doubts

1] if I create 4 .lua filles and send them to esp2866 do I need to compile(node.compile()) them I have seen people compiling the lua file isn't lua an interpreter

2] if I need to compile does the esp2866 have a compiler inbuilt ?

3]if I send the .lua files randomly how does the esp2866 know which is the first instruction to be executed


I am very new to NodeMCU and the 'lua' language myself, but this might be helpful:

https://nodemcu.readthedocs.io/en/master/en/lua-developer-faq/#lua-language

No, I have not 'pre-compiled' my lua code -- I just upload it as 'text' to my NodeMCU devices. The 'mainline' piece of code needs to be called 'init.lua' -- which runs automatically on bootup/restart. It, in turn, can call other pieces of code with any names that we chose.