Problem using Lua API
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?
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; }
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement