2021-01-02 13:31:18 -05:00
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2021-01-12 14:14:38 -05:00
|
|
|
// TRACEBACK ROUTINES
|
2021-01-02 13:31:18 -05:00
|
|
|
//
|
2021-01-12 14:14:38 -05:00
|
|
|
// The following routines are meant to help produce good-quality
|
|
|
|
|
// tracebacks from errors in lua code.
|
2021-01-02 13:31:18 -05:00
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2021-01-12 14:14:38 -05:00
|
|
|
|
2021-01-02 13:31:18 -05:00
|
|
|
#ifndef TRACEBACK_HPP
|
|
|
|
|
#define TRACEBACK_HPP
|
|
|
|
|
|
|
|
|
|
#include "luastack.hpp"
|
|
|
|
|
|
2021-01-12 14:14:38 -05:00
|
|
|
// traceback_coroutine
|
|
|
|
|
//
|
2021-02-20 19:17:20 -05:00
|
|
|
// Given a coroutine which contains an error message, replace
|
|
|
|
|
// the error message with a full traceback. Always returns 1.
|
2021-01-12 14:14:38 -05:00
|
|
|
//
|
2021-02-20 19:17:20 -05:00
|
|
|
int traceback_coroutine(lua_State *L);
|
2021-01-12 14:14:38 -05:00
|
|
|
|
|
|
|
|
// traceback_pcall
|
|
|
|
|
//
|
2022-04-25 17:17:41 -04:00
|
|
|
// 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
|
2022-04-25 17:21:54 -04:00
|
|
|
// no error. Also checks for a yield inside a pcall, which is
|
|
|
|
|
// not allowed, and does an assert-fail in that case.
|
2021-01-12 14:14:38 -05:00
|
|
|
//
|
2022-04-25 17:17:41 -04:00
|
|
|
eng::string traceback_pcall(lua_State *L, int narg, int nret);
|
2021-01-02 13:31:18 -05:00
|
|
|
|
|
|
|
|
#endif // TRACEBACK_HPP
|