Today I decided to test the Lua (the programming language, it means Moon in Portuguese) with FLTK. There is a project called lua-fltk4lua.
Unfortunately the project doesn’t explain how to compile it from source code and it expects the developer uses the “luarocks” package manager to install it.
Although initially I was getting some issues like:
No rule to make target “moon/moon.h”
No rule to make target “compat-5.3/c-api/compat-5.3.h”
I figured out how to get it compiled and working easily, find the steps below:
$ sudo apt-get install lua5.2 $ sudo apt-get install liblua5.2-dev $ sudo apt-get install libfltk1.3-dev $ git clone https://github.com/siffiejoe/lua-fltk4lua $ cd lua-fltk4lua $ git clone https://github.com/siffiejoe/lua-moon moon $ git clone https://github.com/keplerproject/lua-compat-5.3 compat-5.3 $ make $ sudo make install
This is a nice Hello World to see it working, just create a hello.lua file with it:
local fl = require( "fltk4lua" ) local window = fl.Window( 340, 180, "Hello" ) local box = fl.Box( 20, 40, 300, 100, "Hello World!" ) box.box = "FL_UP_BOX" box.labelfont = "FL_HELVETICA_BOLD_ITALIC" box.labelsize = 36 box.labeltype = "FL_SHADOW_LABEL" window:end_group() window:show( arg ) fl.run()
$ lua hello.lua