| 694 | |
| 695 | |
| 696 | static int gmatch (lua_State *L) { |
| 697 | size_t ls, lp; |
| 698 | const char *s = luaL_checklstring(L, 1, &ls); |
| 699 | const char *p = luaL_checklstring(L, 2, &lp); |
| 700 | GMatchState *gm; |
| 701 | lua_settop(L, 2); /* keep them on closure to avoid being collected */ |
| 702 | gm = (GMatchState *)lua_newuserdata(L, sizeof(GMatchState)); |
| 703 | prepstate(&gm->ms, L, s, ls, p, lp); |
| 704 | gm->src = s; gm->p = p; gm->lastmatch = NULL; |
| 705 | lua_pushcclosure(L, gmatch_aux, 3); |
| 706 | return 1; |
| 707 | } |
| 708 | |
| 709 | |
| 710 | static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, |
nothing calls this directly
no test coverage detected