lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi everyone,

This is my first day with Lua, I am trying to build a GUI App,
I have tried NodeJS/Electron, JavaFX and C# which allow for cross
platform GUIs, but the end package would be from anywhere near 50MB to
150MB just for a Hello World GUI program.

 I was really excited to try Lua after seeing a few talks on youtube.

When I downloaded Lua, I was like "How is this even possible".
The Lua binary was just around 230KB!!!
That's even smaller than jQuery and smaller than most GIFs on the
internet today!!

I was able to write a small Lua+FLTK GUI program in under 1 MB.
But FLTK is old & ugly(in my opinion) and I really wanted something
that looked native and modern.

This is where my problems started:

I found a portable C library: https://github.com/andlabs/libui
found another library for Lua bindings https://github.com/zhaozg/lui

libui and lua were very easy to compile because of good documentation,
even though it was my first time compiling C programs as well.

I copied the libui.a
and liblua.a from the lib folder (built using: make macosx local)

I managed to compile zhaozg/lui after porting it to Lua 5.3 and
spending my day figuring out C and it's compilation process.

The compilation succeeded and the command used is as follows on my Mac:

 gcc  -o lui.so  -shared  -framework Foundation -framework AppKit
-fPIC -Isrc src/lui.c -I ../lua-src  -I ../libui  -L . -llua -lui

but now if do something like:  local ui = require "lui"

I get the following error:

lua: multiple Lua VMs detected
stack traceback:
[C]: in ?
[C]: in function 'require'

Any suggestions would be very helpful.

--
-
Warm regards,
Avinash