diff --git a/src/lib_string.c b/src/lib_string.c index 79aeddfc..f161604a 100644 --- a/src/lib_string.c +++ b/src/lib_string.c @@ -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); diff --git a/src/lj_arch.h b/src/lj_arch.h index 5b709f1d..35671072 100644 --- a/src/lj_arch.h +++ b/src/lj_arch.h @@ -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