MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / push_onecapture

Function push_onecapture

libraries/AP_Scripting/lua/src/lstrlib.c:557–573  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

555
556
557static void push_onecapture (MatchState *ms, int i, const char *s,
558 const char *e) {
559 if (i >= ms->level) {
560 if (i == 0) /* ms->level == 0, too */
561 lua_pushlstring(ms->L, s, e - s); /* add whole match */
562 else
563 luaL_error(ms->L, "invalid capture index %%%d", i + 1);
564 }
565 else {
566 ptrdiff_t l = ms->capture[i].len;
567 if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture");
568 if (l == CAP_POSITION)
569 lua_pushinteger(ms->L, (ms->capture[i].init - ms->src_init) + 1);
570 else
571 lua_pushlstring(ms->L, ms->capture[i].init, l);
572 }
573}
574
575
576static int push_captures (MatchState *ms, const char *s, const char *e) {

Callers 3

push_capturesFunction · 0.85
add_sFunction · 0.85
add_valueFunction · 0.85

Calls 3

lua_pushlstringFunction · 0.85
luaL_errorFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected