Guest User

Untitled

a guest
Jan 20th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. int luaErrorHandler(lua_State *m_state) {
  2. if (!lua_isstring(m_state, 1))
  3. return 1;
  4. lua_getfield(m_state, LUA_GLOBALSINDEX, "debug");
  5. if (!lua_istable(m_state, -1)) {
  6. lua_pop(m_state, 1);
  7. return 1;
  8. }
  9. lua_getfield(m_state, -1, "traceback");
  10. if (!lua_isfunction(m_state, -1)) {
  11. lua_pop(m_state, 2);
  12. return 1;
  13. }
  14. lua_pushvalue(m_state, 1); /* pass error message */
  15. lua_pushinteger(m_state, 2);
  16. lua_call(m_state, 2, 1); /* call debug.traceback */
  17.  
  18. return 1;
  19. }
Add Comment
Please, Sign In to add comment