As the title says... Chat on...

User avatar
By j3graham
#8175 I have been experimenting with luac from eLua.

Steps:


- Install a copy of lua for your computer (used for building luac). Avaliable from http://www.lua.org/download.html

- Get the eLua source from http://www.eluaproject.net/get-started/downloads

- From the eLua spirce directory, build the luac cross-compliler executable with:
Code: Select alllua cross-lua.lua

This generates an executable called luac-cross.

- to compile a script for nodemcu:
Code: Select allluac.cross -o myscript.lc -cci 32 -cce little  -ccn int 32  myscript.lua


- upload the myscript.lcbinary file to nodemcu (nodemcu-uploader.py works with binary files - see https://github.com/kmpm/nodemcu-uploader)

- load the script with
Code: Select allrequire("myscript")


Note: if you have a myscript.lua and a myscript.lc, the uncompiled one seems to take precedence)

Simple compiled scripts work, but larger ones seem to cause restarts when they are loaded. When it successful, compiling saves a noticeable amount of heap space.