瀏覽代碼

no more compatibility code for 'string.gfind'

Roberto Ierusalimschy 15 年之前
父節點
當前提交
9107dd115c
共有 2 個文件被更改,包括 3 次插入15 次删除
  1. 2 6
      lstrlib.c
  2. 1 9
      luaconf.h

+ 2 - 6
lstrlib.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lstrlib.c,v 1.143 2009/06/18 16:51:03 roberto Exp roberto $
+** $Id: lstrlib.c,v 1.144 2009/11/24 12:05:44 roberto Exp roberto $
 ** Standard library for string operations and pattern-matching
 ** Standard library for string operations and pattern-matching
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -774,7 +774,7 @@ static int str_format (lua_State *L) {
       strfrmt = scanformat(L, strfrmt, form);
       strfrmt = scanformat(L, strfrmt, form);
       switch (*strfrmt++) {
       switch (*strfrmt++) {
         case 'c': {
         case 'c': {
-          sprintf(buff, form, (int)luaL_checknumber(L, arg));
+          sprintf(buff, form, luaL_checkint(L, arg));
           break;
           break;
         }
         }
         case 'd':  case 'i':
         case 'd':  case 'i':
@@ -860,10 +860,6 @@ static void createmetatable (lua_State *L) {
 */
 */
 LUAMOD_API int luaopen_string (lua_State *L) {
 LUAMOD_API int luaopen_string (lua_State *L) {
   luaL_register(L, LUA_STRLIBNAME, strlib);
   luaL_register(L, LUA_STRLIBNAME, strlib);
-#if defined(LUA_COMPAT_GFIND)
-  lua_getfield(L, -1, "gmatch");
-  lua_setfield(L, -2, "gfind");
-#endif
   createmetatable(L);
   createmetatable(L);
   return 1;
   return 1;
 }
 }

+ 1 - 9
luaconf.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: luaconf.h,v 1.116 2009/11/24 12:05:44 roberto Exp roberto $
+** $Id: luaconf.h,v 1.117 2009/11/26 11:39:20 roberto Exp roberto $
 ** Configuration file for Lua
 ** Configuration file for Lua
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -356,14 +356,6 @@
 */
 */
 #define LUA_COMPAT_API
 #define LUA_COMPAT_API
 
 
-
-/*
-@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
-** CHANGE it to undefined as soon as you rename 'string.gfind' to
-** 'string.gmatch'.
-*/
-#define LUA_COMPAT_GFIND
-
 /*
 /*
 @@ LUA_COMPAT_DEBUGLIB controls compatibility with preloading
 @@ LUA_COMPAT_DEBUGLIB controls compatibility with preloading
 @* the debug library.
 @* the debug library.