I'm tasked with implementing Lua into an existing C++ codebase. I've looked at Luna, Luabind, and tolua++ and I thought that Luabind was the most appealing choice of binding Lua and C++.
After getting LuaBind all set up to compile and run, I'm having trouble getting it to work in the most basic sense.
I have a ScriptingManager open up a LuaState, which is held throughout the life of the game. Later, once an object is created, I bind a very basic test function to Lua.
void testabc()
{
return;
}
luabind::module(gScriptManager->GetState())
[
luabind::def("testabc", &testabc)
];
Very basic, right?
Well, I later have a script which merely has a function call to testabc, and is just as such:
test.lua:
testabc()
This is the code that is supposed to run it, however I am getting an error code (supposedly a Yield from Lua).
void ScriptingManager::Run(const char* script)
{
int ret = luaL_dofile(m_luaState, script);
if(ret != 0)
{
if(!lua_isstring(m_luaState, lua_gettop(m_luaState)))
{
return;
}
std::string err = lua_tostring(m_luaState, lua_gettop(m_luaState));
lua_pop(m_luaState, 1);
}
}
The return value I am getting is 1, however the error message is the following:
Quote:void
ðºtestabc()
That's it. Nothing descriptive, but just the function itself it seems.
Can anyone help figure out what the problem is?
[Edited by - Iced_Eagle on July 28, 2009 2:58:24 PM]