Hi all.
I have a little problem with luabind. When i compile and ru my program in debug, it works fine, no problem there. But when I try to do the same thing in release, it compiles but crashes when I try to bind my first class with luabind.
Here is the initalize:
_lState = lua_open();
luaL_openlibs( _lState );
luabind::open( _lState );
Ogre::String folder = cf.getSetting("LUADir");
int size = Ogre::StringConverter::parseInt(cf.getSetting("NumberOfScripts"));
int error;
for(int i = 0; i < size; i++)
{
error = luaL_dofile(_lState, (folder+cf.getSetting("ScriptFile", Ogre::StringConverter::toString(i))).c_str());
if( error != 0 )
{
std::cout << "Cant read the file at: " << folder << cf.getSetting("ScriptFile", Ogre::StringConverter::toString(i)).c_str() << std::endl;
return false;
}
_loopSpawn.push_back(cf.getSetting("LoopStart", Ogre::StringConverter::toString(i)).c_str());
}
And here is the class binding where my program crashes:
luabind::module(LUAManager::GetInstance()->GetState())
[
luabind::class_<StateMachine<Robot>>("StateMachine")
.def("ChangeState", &StateMachine<Robot>::ChangeState)
.def("CurrentState", &StateMachine<Robot>::CurrentState)
.def("SetCurrentState", &StateMachine<Robot>::SetCurrentState)
];
I do nothing lua related between these chunks of code, so I dont think you need any more code than that. And when it crashes, it says: "Expresion: vector iterator not dereferecable". I know what it means, but I do not know the cause.
As you can see, the class I try to bind is a template, if that could be the problem, but as it works with the debug, I think it would be strange.
Any help would be appreciated.