-->
Page 1 of 1

There is Luac for Lua nodeMCU?

PostPosted: Sun Jan 18, 2015 1:11 pm
by alexhi
There is Luac for Lua nodeMCU?

Re: There is Luac for Lua nodeMCU?

PostPosted: Sun Jan 25, 2015 11:39 am
by j3graham
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.

Re: There is Luac for Lua nodeMCU?

PostPosted: Sun Jan 25, 2015 2:07 pm
by alexhi
Thanks, I'll try it