/////////////////////////////////////////////////////////////////
//
// TRACEBACK ROUTINES
//
// The following routines are meant to help produce good-quality
// tracebacks from errors in lua code.
//
/////////////////////////////////////////////////////////////////


#pragma once

#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);
