Reputation: 1484
I am new to Lua and especially new to Luabind. When I tried to compile (with Clang++), my first file using Luabind:
#define LUA_COMPAT_ALL
#include <luabind/luabind.hpp>
#include <luaconf.h>
#include <iostream>
int main() {
lua_State *myLuaState = luaL_newstate();
luabind::open(myLuaState);
luaL_dostring(
myLuaState,
"function add(first, second)\n"
" return first + second\n"
"end\n"
);
std::cout << "Result: "
<< luabind::call_function<int>(myLuaState, "add", 2, 3)
<< std::endl;
lua_close(myLuaState);
}
I got a whole heap of error messages.
So, I did a bit of looking around I found it had to do with my Lua version being 5.2 vs 5.1 and found that the solution was LUA_COMPAT_ALL
(which I found out at Lua project compiling with errors (luabind)).
Unfortunately, I'm a bit of a scrub when it comes to Lua; so, I don't know where I put that.
I hope my question wasn't too stupid :)
Upvotes: 1
Views: 407
Reputation: 755
Just defining it in your code should work, as told in the Lua source (CTRL+F for "LUA_COMPAT_ALL"): http://www.lua.org/source/5.2/luaconf.h.html
(It might've been in the manual, but removed from it later on)
Upvotes: 1