diff --git a/luaa.h b/luaa.h index 1ee99181..ead2514a 100644 --- a/luaa.h +++ b/luaa.h @@ -57,8 +57,10 @@ luaA_warn(lua_State *L, const char *fmt, ...) va_end(ap); fprintf(stderr, "\n"); +#if LUA_VERSION_NUM >= 502 luaL_traceback(L, L, NULL, 2); fprintf(stderr, "%s\n", lua_tostring(L, -1)); +#endif } static inline int @@ -66,8 +68,10 @@ 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)); +#if LUA_VERSION_NUM >= 502 luaL_traceback(L, L, NULL, 2); lua_concat(L, 2); +#endif return luaL_argerror(L, narg, msg); }