MCPcopy Create free account
hub / github.com/Tencent/UnLua / Lslice_enter

Function Lslice_enter

Plugins/UnLuaExtensions/LuaProtobuf/Source/src/pb.cpp:1084–1101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1082}
1083
1084static int Lslice_enter(lua_State *L) {
1085 lpb_Slice *s = check_lslice(L, 1);
1086 pb_Slice view;
1087 if (lua_isnoneornil(L, 2)) {
1088 argcheck(L, pb_readbytes(&s->curr, &view) != 0,
1089 1, "bytes wireformat expected at offset %d", pb_pos(s->curr)+1);
1090 view.start = view.p;
1091 lpb_enterview(L, s, view);
1092 } else {
1093 lua_Integer r[] = {1, -1};
1094 lua_Integer range = rangerelat(L, 2, r, pb_len(s->curr));
1095 view.p = s->curr.start + r[0] - 1;
1096 view.end = view.p + range;
1097 view.start = s->curr.p;
1098 lpb_enterview(L, s, view);
1099 }
1100 return_self(L);
1101}
1102
1103static int Lslice_leave(lua_State *L) {
1104 lpb_Slice *s = check_lslice(L, 1);

Callers

nothing calls this directly

Calls 7

check_lsliceFunction · 0.85
argcheckFunction · 0.85
pb_readbytesFunction · 0.85
pb_posFunction · 0.85
lpb_enterviewFunction · 0.85
rangerelatFunction · 0.85
pb_lenFunction · 0.85

Tested by

no test coverage detected