Problem using Lua API

Started by
1 comment, last by cdmac 19 years, 2 months ago
Hi, I'm trying to use Lua 5 with C++, but it just won't work. I originally compiled my own libraries, then found some pre-compiled libraries on the web, but I always get a linker error. Specifically with lua_dofile() and lua_dostring(). The project is linked to Lua+Lib.lib, and I've used the extern "C" for the includes. Any ideas?
Advertisement
Those functions are defined in the auxiliary library (lauxlib.h), but are deprecated and might not be available in your distribution. I'd suggest you try the luaL_loadfile function instead. Example:

    luaL_loadfile (L, "script.lua");    if (lua_isfunction (L, -1))    {        lua_pcall (L, 0, 0, 0);    }    else    {        std::cout << "error: script.lua not found!" << std::endl;    }
¨@_
Thanks! I've been pulling at my hair for hours.

This topic is closed to new replies.

Advertisement