Browse Source

stand-alone error-message details

Roberto Ierusalimschy 18 years ago
parent
commit
c676f13e1a
2 changed files with 5 additions and 5 deletions
  1. 2 2
      lauxlib.c
  2. 3 3
      lua.c

+ 2 - 2
lauxlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lauxlib.c,v 1.171 2007/06/22 15:39:34 roberto Exp roberto $
+** $Id: lauxlib.c,v 1.172 2007/08/10 12:56:02 roberto Exp roberto $
 ** Auxiliary functions for building Lua libraries
 ** See Copyright Notice in lua.h
 */
@@ -99,7 +99,7 @@ static void pushfuncname (lua_State *L, lua_Debug *ar) {
   else if (*ar->what == 'm')  /* main? */
       lua_pushfstring(L, "main chunk");
   else if (*ar->what == 'C' || *ar->what == 't')
-    lua_pushliteral(L, " ?");  /* C function or tail call */
+    lua_pushliteral(L, "?");  /* C function or tail call */
   else
     lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined);
 }

+ 3 - 3
lua.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lua.c,v 1.166 2007/06/22 15:33:54 roberto Exp roberto $
+** $Id: lua.c,v 1.167 2007/08/07 16:53:40 roberto Exp roberto $
 ** Lua stand-alone interpreter
 ** See Copyright Notice in lua.h
 */
@@ -76,7 +76,7 @@ static int report (lua_State *L, int status) {
 static int traceback (lua_State *L) {
   const char *msg = lua_tostring(L, 1);
   if (msg)
-    luaL_traceback(L, L, msg, 2);
+    luaL_traceback(L, L, msg, 1);
   else if (!lua_isnoneornil(L, 1)) {  /* is there an error object? */
     if (!luaL_callmeta(L, 1, "__tostring"))  /* try its 'tostring' metamethod */
       lua_pushliteral(L, "(no error message)");
@@ -141,7 +141,7 @@ static int dostring (lua_State *L, const char *s, const char *name) {
 static int dolibrary (lua_State *L, const char *name) {
   lua_getglobal(L, "require");
   lua_pushstring(L, name);
-  return report(L, lua_pcall(L, 1, 0, 0));
+  return report(L, docall(L, 1, 1));
 }