0 Replies Latest reply on Dec 22, 2014 9:36 AM by Tesla

    How to install LUA on your Edison

    Tesla

      Hi folks,

       

      I would like to share with you how I installed LUA on my Edison, and with some help from more experienced Linux users, got it running.

       

      Firstly LUA is a simple, portable, extensible and efficient scripting language widely used in the gaming, mobile device and embedded systems communities. For more information visit www.lua.com . .

      From a user with root permissions carry out the following :

       

      Step one - Download the compressed C source code

       

           wget http://www.lua.org/ftp/lua-5.2.3.tar.gz

       

      When the download has finished:-

       

      Step 2 - Decompress the downloaded file

       

           tar zxf lua-5.2.3.tar.gz

       

      Step 3 - Compile and make the file

       

           cd lua-5.2.3

           make linux test

       

      Step 4 Using whatever text editor you like make a text file called hello.lua with the following contents :-

       

           print("Hello World")

       

      and save it into the /lua-5.2.3/src directory.

       

      Step 5 List the /lua-5.2.3/src directory. You should see  this :-

       

            root@Tesla:/lua-5.2.3/src# l

           Makefile    lcode.o     ldump.c     llex.h      lopcodes.h  lstrlib.o   luac

           hello.lua   lcorolib.c  ldump.o     llex.o      lopcodes.o  ltable.c    luac.c

           lapi.c      lcorolib.o  lfunc.c     llimits.h   loslib.c    ltable.h    luac.o

           lapi.h      lctype.c    lfunc.h     lmathlib.c  loslib.o    ltable.o    luaconf.h

           lapi.o      lctype.h    lfunc.o     lmathlib.o  lparser.c   ltablib.c   lualib.h

           lauxlib.c   lctype.o    lgc.c       lmem.c      lparser.h   ltablib.o   lundump.c

           lauxlib.h   ldblib.c    lgc.h       lmem.h      lparser.o   ltm.c       lundump.h

           lauxlib.o   ldblib.o    lgc.o       lmem.o      lstate.c    ltm.h       lundump.o

           lbaselib.c  ldebug.c    liblua.a    loadlib.c   lstate.h    ltm.o       lvm.c

           lbaselib.o  ldebug.h    linit.c     loadlib.o   lstate.o    lua         lvm.h

           lbitlib.c   ldebug.o    linit.o     lobject.c   lstring.c   lua.c       lvm.o

           lbitlib.o   ldo.c       liolib.c    lobject.h   lstring.h   lua.h       lzio.c

           lcode.c     ldo.h       liolib.o    lobject.o   lstring.o   lua.hpp     lzio.h

           lcode.h     ldo.o       llex.c      lopcodes.c  lstrlib.c   lua.o       lzio.o    

       

      Step 6 Test that Lua works :-

       

           root@Tesla:/lua-5.2.3/src# ./lua hello.lua

       

      and you should see this response

       

           Hello World

       

      Which means all is well

       

      Step 7 You need to tell Linux where is should look for the Lua when you want to run it. This information is stored in the system variable $PATH

       

      to find out what is in PATH on your system type :

       

      echo $PATH

       

      At this point you have an number of choices. Either add the current location of Lua to the PATH variable, or move the files to a place already referred to in the PATH variable. You should choose what is best for you. I chose to follow the advice given by deium which is quoted in full :-

       

      "You will have to keep in mind where your space is on the Edison and put as much in the partitions that have your free space.

      In the default image, issuing a df command will give you your partitions, you will note that /home has your free space.

      In that light, I would move your lua-5.2.3 to /home/lua-5.2.3 and then use a soft link (adjusted from above)

      mv /lua-5.2.3 /home

      ln -s /home/lua-5.2.3/src/lua /usr/bin/lua

      chmod 755 /usr/bin/lua

      this way the least amount of space used from /usr/bin is used by the link (which is the root / partition)"

       

      Thanks also to  pabu and KurtE