MCPcopy Create free account
hub / github.com/DFHack/dfhack / gmatch

Function gmatch

depends/lua/src/lstrlib.c:689–700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

687
688
689static int gmatch (lua_State *L) {
690 size_t ls, lp;
691 const char *s = luaL_checklstring(L, 1, &ls);
692 const char *p = luaL_checklstring(L, 2, &lp);
693 GMatchState *gm;
694 lua_settop(L, 2); /* keep them on closure to avoid being collected */
695 gm = (GMatchState *)lua_newuserdata(L, sizeof(GMatchState));
696 prepstate(&gm->ms, L, s, ls, p, lp);
697 gm->src = s; gm->p = p; gm->lastmatch = NULL;
698 lua_pushcclosure(L, gmatch_aux, 3);
699 return 1;
700}
701
702
703static void add_s (MatchState *ms, luaL_Buffer *b, const char *s,

Callers

nothing calls this directly

Calls 5

luaL_checklstringFunction · 0.85
lua_settopFunction · 0.85
lua_newuserdataFunction · 0.85
prepstateFunction · 0.85
lua_pushcclosureFunction · 0.85

Tested by

no test coverage detected