From 5e6f104e0e12d0e7322d3f21af5fd35b9a1b478c Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 28 Jul 2015 04:06:10 +0200 Subject: [PATCH] Use luaL_traceback only with Lua 5.2+ It has been added in Lua 5.2, and should not require us to bump the Lua dependency. It is only meant to provide useful information, but is not required. This is a follow-up to 6e97b5f8. --- luaa.h | 4 ++++ 1 file changed, 4 insertions(+) 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); }