Important: Please read the Qt Code of Conduct -

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:



    so i copy it in my QT applications in folder( named lua_macosx) below:


    include below:
    INCLUDEPATH +=$$quote(lua_macosx/include)
    LIBS += -L$$quote(lua_macosx/lib) -llua

    so 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(..)

    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.

Log in to reply