Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can i use Lua in MacOS X with creator?????
Forum Updated to NodeBB v4.3 + New Features

How can i use Lua in MacOS X with creator?????

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zjh4101132
    wrote on last edited by
    #1

    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.a

    include test.pro 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(..)
    {
    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.

    1 Reply Last reply
    0
    • W Offline
      W Offline
      wwolff
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved