Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 1, 2006, 5:07:28 PM (18 years ago)
Author:
snellen
Message:

started implementing script_manager

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/script_engine/src/lib/script_engine/script.cc

    r8075 r8085  
    2929
    3030   if(currentFile.length() != 0)
     31   {
    3132     printf("Could not load %s because an other file is already loaded: %s\n",filename.c_str(), currentFile.c_str());
     33     return false;
     34    }
    3235
    3336   int error = luaL_loadfile (luaState, filename.c_str());
     
    7477 bool Script::selectFunction(std::string& functionName, int retCount)
    7578 {
    76    if(returnCount == 0) //no return values left on the stack
     79   if(returnCount == 0 && currentFunction.length() == 0) //no return values left on the stack and no other function selected
    7780   {
    7881   lua_pushlstring(luaState, functionName.c_str(), functionName.size() );
     
    9093   }
    9194   else
    92      printf("there are unremoved return values on the stack. Please remove them first.\n");
     95     printf("There is an other function active ( %s ) or there are unremoved return values on the stack. Please remove them first.\n",currentFunction.c_str());
     96   return false;
    9397 }
    9498
     
    214218 int Script::reportError(int error)
    215219 {
    216  const char *msg = lua_tostring(luaState, -1);
    217  if (msg == NULL) msg = "(error with no message)";
    218  fprintf(stderr, "ERROR: %s\n", msg);
    219  lua_pop(luaState, 1);
    220  return error;
    221  }
    222 
     220 if(error != 0)
     221 {
     222  const char *msg = lua_tostring(luaState, -1);
     223  if (msg == NULL) msg = "(error with no message)";
     224  fprintf(stderr, "ERROR: %s\n", msg);
     225  lua_pop(luaState, 1);
     226  return error;
     227 }
     228 }
     229
Note: See TracChangeset for help on using the changeset viewer.