Use luaL_traceback with luaA_warn and luaA_typerror
This commit is contained in:
parent
ddb1f64acd
commit
6e97b5f8c5
5
luaa.h
5
luaa.h
|
@ -56,6 +56,9 @@ luaA_warn(lua_State *L, const char *fmt, ...)
|
||||||
vfprintf(stderr, fmt, ap);
|
vfprintf(stderr, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
|
luaL_traceback(L, L, NULL, 2);
|
||||||
|
fprintf(stderr, "%s\n", lua_tostring(L, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
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",
|
const char *msg = lua_pushfstring(L, "%s expected, got %s",
|
||||||
tname, luaL_typename(L, narg));
|
tname, luaL_typename(L, narg));
|
||||||
|
luaL_traceback(L, L, NULL, 2);
|
||||||
|
lua_concat(L, 2);
|
||||||
return luaL_argerror(L, narg, msg);
|
return luaL_argerror(L, narg, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue