Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int luaErrorHandler(lua_State *m_state) {
- if (!lua_isstring(m_state, 1))
- return 1;
- lua_getfield(m_state, LUA_GLOBALSINDEX, "debug");
- if (!lua_istable(m_state, -1)) {
- lua_pop(m_state, 1);
- return 1;
- }
- lua_getfield(m_state, -1, "traceback");
- if (!lua_isfunction(m_state, -1)) {
- lua_pop(m_state, 2);
- return 1;
- }
- lua_pushvalue(m_state, 1); /* pass error message */
- lua_pushinteger(m_state, 2);
- lua_call(m_state, 2, 1); /* call debug.traceback */
- return 1;
- }
Add Comment
Please, Sign In to add comment