MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / getcaptures

Function getcaptures

other_src/lua/src/lpeg.cpp:2232–2248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2230
2231
2232static int getcaptures (lua_State *L, const char *s, const char *r, int ptop) {
2233 Capture *capture = (Capture *)lua_touserdata(L, caplistidx(ptop));
2234 int n = 0;
2235 if (!isclosecap(capture)) { /* is there any capture? */
2236 CapState cs;
2237 cs.ocap = cs.cap = capture; cs.L = L;
2238 cs.s = s; cs.valuecached = 0; cs.ptop = ptop;
2239 do { /* collect their values */
2240 n += pushcapture(&cs);
2241 } while (!isclosecap(cs.cap));
2242 }
2243 if (n == 0) { /* no capture values? */
2244 lua_pushinteger(L, r - s + 1); /* return only end position */
2245 n = 1;
2246 }
2247 return n;
2248}
2249
2250/* }====================================================== */
2251

Callers 1

matchlFunction · 0.85

Calls 3

pushcaptureFunction · 0.85
lua_touserdataFunction · 0.70
lua_pushintegerFunction · 0.70

Tested by

no test coverage detected