Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. void ssuge::ScriptManager::executeScriptMethod(std::string fileName, std::string methodName, std::string goName, std::string groupName)
  2. {
  3.     //Stack as expected                                                 [...]
  4.     lua_getglobal(mLua, groupName.c_str());//                           [..., groupTable]
  5.     lua_getglobal(mLua, fileName.c_str());//                            [..., groupTable, script_module]
  6.     lua_getfield(mLua, -1, methodName.c_str());//                       [..., groupTable, script_module, method]
  7.     lua_getfield(mLua, -3, goName.c_str());//                           [..., groupTable, script_module, method, inst]
  8.     lua_pcall(mLua, 1, 0, 0);
  9.     if (lua_isstring(mLua, -1))
  10.     {
  11.         std::string errMsg = lua_tostring(mLua, -1);
  12.         std::cout << "Error in running method:" << methodName << " in " << fileName << std::endl;
  13.         std::cout << errMsg << std::endl;
  14.         LOG_MANAGER->log(errMsg, LL_ERROR);
  15.         stackDump_log(mLua);
  16.         dumpCallStack_log(mLua);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement