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
|
|
|
|
|
//
|
|
|
|
|
// Given a coroutine and an error message, returns a traceback
|
|
|
|
|
// of the coroutine.
|
|
|
|
|
//
|
2021-01-02 13:31:18 -05:00
|
|
|
int traceback_coroutine(lua_State *L);
|
2021-01-12 14:14:38 -05:00
|
|
|
|
|
|
|
|
// traceback_handler
|
|
|
|
|
//
|
|
|
|
|
// The function 'pcall' expects you to pass in a message handler routine.
|
|
|
|
|
// 'traceback_handler' is designed to be used as this argument to pcall.
|
|
|
|
|
//
|
2021-01-02 13:31:18 -05:00
|
|
|
int traceback_handler(lua_State *L);
|
2021-01-12 14:14:38 -05:00
|
|
|
|
|
|
|
|
// traceback_pcall
|
|
|
|
|
//
|
|
|
|
|
// same as lua_pcall, except that it automatically supplies traceback_handler as
|
|
|
|
|
// a message handler.
|
|
|
|
|
//
|
2021-01-02 13:31:18 -05:00
|
|
|
int traceback_pcall(lua_State *L, int narg, int nret);
|
|
|
|
|
|
|
|
|
|
#endif // TRACEBACK_HPP
|