// TODO: Merge with luaLevelGenerator version, which is almost identical
bool Console::prepareEnvironment()  
{ 
#ifndef BF_NO_CONSOLE

   if(!Parent::prepareEnvironment())
      return false;

   setScriptContext(L, ConsoleContext);

   TNLAssert(lua_gettop(L) == 0 || dumpStack(L), "Stack not cleared!");

#endif

   return true;
}
Beispiel #2
0
// Actually fire the event, called by one of the fireEvent() methods above
// Returns true if there was an error, false if everything ran ok
bool EventManager::fire(lua_State *L, LuaScriptRunner *scriptRunner, const char *function, ScriptContext context)
{
   setScriptContext(L, context);

   bool ok = false;
   
   try 
   {
      ok = scriptRunner->runFunction(function, 0);
   }
   catch(...)
   {
      logprintf("???");
   }
   
   return ok;
}