How can i use Lua in MacOS X with creator?????
-
i meet a problem with using lua in creator.
i have already complier lua source code with command line:
make macosx install.i have get files below:
/usr/local/bin/lua
/usr/local/bin/luac/usr/local/include/lua.h
/usr/local/include/lauxlib.h
/usr/local/include/lua..hpp
/usr/local/include/luaconf.h
/usr/local/include/lualib.h/usr/local/lib/liblua.a
so i copy it in my QT applications in folder( named lua_macosx) below:
./lua_macosx/include/lua.h
./lua_macosx/include/lauxlib.h
./lua_macosx/include/lua..hpp
./lua_macosx/include/luaconf.h
./lua_macosx/include/lualib.h
./lua_macosx/lib/liblua.a./lua_macosx/lib/lua
./lua_macosx/lib/luac
./lua_macosx/lib/liblua.ainclude test.pro below:
INCLUDEPATH +=$$quote(lua_macosx/include)
LIBS += -L$$quote(lua_macosx/lib) -lluaso in my main.cpp below:
extern "C" {
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
}
void testlua()
{
lua_State *L = lua_open();
int a = luaopen_base(L);
int b = luaopen_string(L);
int i = luaL_loadfile(L,"mytest.lua");//error i = 6
int j = lua_pcall(L,0,0,0); //error j = 2}
int main(..)
{
testlua();
}so when i call the funtion (testlua), it will get a wrong code ,so how can i using the lua crorrectly.
please help me.
-
Hi!
I dont Know if you already solve your problem, but i made a new compilation to Use Lua in My Project and are fully functional, but i´m using it only in Win32 and Win64 yet , but it will be easy to you , since i compile the libraries in Qt Creator.
I Use tolua to bind all my custom objects on the system and use a thread to handle all the lifecycle of the script.
Acctually i´m Using Lua 5.2.2 with tolua 5.2.0 , and are working really fine for my 3D Engine.
Another detail is some functions you are using are deprecated in Lua, i suggest you get the last source codes(5.2.2)
If you need the source Codes, please drop me a message , or send a reply than i will try find out a way to give to you the Qt projects already organised to you compile and use it , ok?Kind Regards.