Author Topic: LUA 5.2 wrapper  (Read 7968 times)

Offline Albert

  • Dr. Type
  • ****
  • Posts: 257
    • View Profile
    • Blog
LUA 5.2 wrapper
« on: 2012-Jun-25 »
This is my attempt to embed LUA into glBasic in a cross-platform cross-compile way.

Tested in Windows and Android.
Added only some of the LUA commands, and a little set of GLBasic commands for testing purposes.
I hope that one of you interested in and have enough knowledge (more than me) to fix and extend this little sample.

Download with source: https://dl.dropbox.com/u/292449/glbasic/lua/lua1.zip
Install on Android: https://dl.dropbox.com/u/292449/glbasic/lua/lua1.apk


MrTAToad

  • Guest
Re: LUA 5.2 wrapper
« Reply #1 on: 2012-Jun-25 »
Will be interesting to know if it compiles on a Mac too

Offline Albert

  • Dr. Type
  • ****
  • Posts: 257
    • View Profile
    • Blog
Re: LUA 5.2 wrapper
« Reply #2 on: 2012-Jun-25 »
Please sbody try to compile to various platforms and test it. iPhone, linux, MacOS are the main platforms i want to know if compatible

Tapatalk 2-vel küldve az én GT-I9000-ről

MrTAToad

  • Guest
Re: LUA 5.2 wrapper
« Reply #3 on: 2012-Jun-25 »
I'll try Linux later on...

Bad news - as it standards, it won't compile - it doesn't find the header files unfortunately.
« Last Edit: 2012-Jun-25 by MrTAToad »

Offline trucidare

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1377
  • Bachelor of Fail
    • View Profile
Re: LUA 5.2 wrapper
« Reply #4 on: 2012-Jun-25 »
anyone using linux should provide the current headers. so lua will compile fine on linux - on osx is a bit tricky but possible.
MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

MrTAToad

  • Guest
Re: LUA 5.2 wrapper
« Reply #5 on: 2012-Jun-25 »
Problem is it wont compile :

Code: GLBasic [Select]
/cygdrive/C/Users/Nicholas/AppData/Local/Temp/glbasic/gpc_temp1.cpp:54:18: math.h: No such file or directory
In file included from /cygdrive/C/Users/Nicholas/Desktop/lua/src/lapi.c:14,
                 from /cygdrive/C/Users/Nicholas/AppData/Local/Temp/glbasic/gpc_temp1.cpp:56:
/cygdrive/C/Users/Nicholas/Desktop/lua/src/lua.h:12:20: stdarg.h: No such file or directory
/cygdrive/C/Users/Nicholas/Desktop/lua/src/lua.h:13:20: stddef.h: No such file or directory
In file included from /cygdrive/C/Users/Nicholas/Desktop/lua/src/lua.h:16,
                 from /cygdrive/C/Users/Nicholas/Desktop/lua/src/lapi.c:14,
                 from /cygdrive/C/Users/Nicholas/AppData/Local/Temp/glbasic/gpc_temp1.cpp:56:
/cygdrive/C/Users/Nicholas/Desktop/lua/src/luaconf.h:11:20: limits.h: No such file or directory
/cygdrive/C/Users/Nicholas/Desktop/lua/src/luaconf.h:12:20: stddef.h: No such file or directory

I have come across this when using some code with Android - it looks like the compiler believes the path for the headers and code is different from it should be.

Offline Albert

  • Dr. Type
  • ****
  • Posts: 257
    • View Profile
    • Blog
Re: LUA 5.2 wrapper
« Reply #6 on: 2012-Jun-26 »
Add to the compiler options:
Code: GLBasic [Select]
-I"%PROJECT_PATH%\include\linux" -I"%PROJECT_PATH%\include"
These are mingw win32 headers from the glBasic header rar. But I have a lot of problems with them :(

Offline Albert

  • Dr. Type
  • ****
  • Posts: 257
    • View Profile
    • Blog
Re: LUA 5.2 wrapper
« Reply #7 on: 2012-Jun-26 »
you can add additional headers into the directory: include\linux

Offline Albert

  • Dr. Type
  • ****
  • Posts: 257
    • View Profile
    • Blog
Re: LUA 5.2 wrapper
« Reply #8 on: 2012-Jun-26 »
I've needed to add big subset of glbasic header.rar and a #define LUA_USE_LINUX
Somebody please check this on linux:
https://dl.dropbox.com/u/292449/glbasic/lua/lua_linux.zip

Update: Somebody verified it"s works under linux!
« Last Edit: 2012-Jun-26 by Albert »

Offline Albert

  • Dr. Type
  • ****
  • Posts: 257
    • View Profile
    • Blog
Re: LUA 5.2 wrapper
« Reply #9 on: 2012-Jun-26 »
Screenshot from linux version.
Also I've updated the zip in the first post

« Last Edit: 2012-Jun-26 by Albert »

MrTAToad

  • Guest
Re: LUA 5.2 wrapper
« Reply #10 on: 2012-Jun-26 »
Still having trouble getting it to compile for Linux...  Just wont find the headers for some reason...

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4218
    • View Profile
    • Portfolio
Re: LUA 5.2 wrapper
« Reply #11 on: 2012-Jun-26 »
If you guys would pardon the naive question...

What would be in for having LUA with GLBasic?

Within the little I know, lua is a script language widely used by other applications, like gfx or 3d applications.
What would be the benefits down to GLB?

MrTAToad

  • Guest
Re: LUA 5.2 wrapper
« Reply #12 on: 2012-Jun-26 »
Scripting allows a program to be controlled with external code - I want to include a scripting system in TSetup which will allow control of sprites (movement, scaling etc) and text.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4218
    • View Profile
    • Portfolio
Re: LUA 5.2 wrapper
« Reply #13 on: 2012-Jun-27 »
ok, sounds promising! :good:

Offline Albert

  • Dr. Type
  • ****
  • Posts: 257
    • View Profile
    • Blog
Re: LUA 5.2 wrapper
« Reply #14 on: 2012-Jun-27 »
Ok now I downloaded the lua1.rar to a second laptop, and tried to compile to linux, I have one compiler error, limits.h not found, strange 'cos there are 2 of them already, but in the limits.h there is this row:
Code: GLBasic [Select]
#include_next "limits.h"
never seemed include_next before, but google says that the compiler look further in the include directories to a secondary limits.h file.
I will check it out today.