浏览代码

detail (better error message for invalid format)

Roberto Ierusalimschy 19 年之前
父节点
当前提交
fe8f4c06f1
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      lstrlib.c

+ 3 - 2
lstrlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstrlib.c,v 1.130 2005/12/29 15:32:11 roberto Exp roberto $
+** $Id: lstrlib.c,v 1.131 2006/04/12 20:13:52 roberto Exp roberto $
 ** Standard library for string operations and pattern-matching
 ** See Copyright Notice in lua.h
 */
@@ -809,7 +809,8 @@ static int str_format (lua_State *L) {
           }
         }
         default: {  /* also treat cases `pnLlh' */
-          return luaL_error(L, "invalid option to " LUA_QL("format"));
+          return luaL_error(L, "invalid option " LUA_QL("%%%c") " to "
+                               LUA_QL("format"), *(strfrmt - 1));
         }
       }
       luaL_addlstring(&b, buff, strlen(buff));