add LUA_COMPAT_GFIND

This commit is contained in:
fesily 2023-08-18 14:33:39 +08:00
parent e8811a28d9
commit 3c79770bcb
2 changed files with 8 additions and 0 deletions

View File

@ -662,6 +662,10 @@ LUALIB_API int luaopen_string(lua_State *L)
GCtab *mt;
global_State *g;
LJ_LIB_REG(L, LUA_STRLIBNAME, string);
#ifdef LUA_COMPAT_GFIND
lua_getfield(L, -1, "gmatch");
lua_setfield(L, -2, "gfind");
#endif
mt = lj_tab_new(L, 0, 1);
/* NOBARRIER: basemt is a GC root. */
g = G(L);

View File

@ -774,4 +774,8 @@ extern void *LJ_WIN_LOADLIBA(const char *path);
#define LJ_DS_IO_FOPEN_PATCH LJ_DS
#endif
#ifndef LUA_COMPAT_GFIND
#define LUA_COMPAT_GFIND LJ_DS
#endif
#endif