aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-05-15 15:57:44 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-05-15 15:57:44 -0300
commitb7a0503c1d72603b8f7e480f2abecbc05348cb69 (patch)
treebfac646fea320f73abec2ee57a0c96a704452884 /lauxlib.c
parent1c328a191a8b86b7ad601cb9a935f1da5373fdf7 (diff)
downloadlua-b7a0503c1d72603b8f7e480f2abecbc05348cb69.tar.gz
lua-b7a0503c1d72603b8f7e480f2abecbc05348cb69.tar.bz2
lua-b7a0503c1d72603b8f7e480f2abecbc05348cb69.zip
new format for error messages
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 2537ca8c..ecaa6c8f 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.68 2002/05/06 19:05:10 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.69 2002/05/07 17:36:56 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -151,10 +151,17 @@ LUALIB_API void luaL_vstr (lua_State *L, const char *fmt, ...) {
151 151
152 152
153LUALIB_API int luaL_verror (lua_State *L, const char *fmt, ...) { 153LUALIB_API int luaL_verror (lua_State *L, const char *fmt, ...) {
154 lua_Debug ar;
154 va_list argp; 155 va_list argp;
155 va_start(argp, fmt); 156 va_start(argp, fmt);
156 lua_vpushstr(L, fmt, argp); 157 lua_vpushstr(L, fmt, argp);
157 va_end(argp); 158 va_end(argp);
159 if (lua_getstack(L, 1, &ar)) { /* check calling function */
160 lua_getinfo(L, "Snl", &ar);
161 if (ar.currentline > 0)
162 luaL_vstr(L, "%s:%d: %s",
163 ar.short_src, ar.currentline, lua_tostring(L, -1));
164 }
158 return lua_errorobj(L); 165 return lua_errorobj(L);
159} 166}
160 167