Files
integration/luprex/cpp/core/traceback.hpp
2023-02-14 14:05:45 -05:00

34 lines
959 B
C++

/////////////////////////////////////////////////////////////////
//
// TRACEBACK ROUTINES
//
// The following routines are meant to help produce good-quality
// tracebacks from errors in lua code.
//
/////////////////////////////////////////////////////////////////
#ifndef TRACEBACK_HPP
#define TRACEBACK_HPP
#include "luastack.hpp"
// traceback_coroutine
//
// Given a coroutine which contains an error message, replace
// the error message with a full traceback. Always returns 1.
//
int traceback_coroutine(lua_State *L);
// traceback_pcall
//
// Similar to lua_pcall, except that it automatically supplies
// traceback_coroutine as a message handler. It also automatically
// returns any error message. Returns empty string if there's
// no error. Also checks for a yield inside a pcall, which is
// not allowed, and does an assert-fail in that case.
//
eng::string traceback_pcall(lua_State *L, int narg, int nret);
#endif // TRACEBACK_HPP