From 6e97b5f8c559b22d5de749ef680711bd578f418d Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 16 Jul 2015 15:25:39 +0200 Subject: [PATCH] Use luaL_traceback with luaA_warn and luaA_typerror --- luaa.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/luaa.h b/luaa.h index 6b6b38087..1ee991815 100644 --- a/luaa.h +++ b/luaa.h @@ -56,6 +56,9 @@ luaA_warn(lua_State *L, const char *fmt, ...) vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, "\n"); + + luaL_traceback(L, L, NULL, 2); + fprintf(stderr, "%s\n", lua_tostring(L, -1)); } static inline int @@ -63,6 +66,8 @@ luaA_typerror(lua_State *L, int narg, const char *tname) { const char *msg = lua_pushfstring(L, "%s expected, got %s", tname, luaL_typename(L, narg)); + luaL_traceback(L, L, NULL, 2); + lua_concat(L, 2); return luaL_argerror(L, narg, msg); }