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

Function Lslice_level

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

Source from the content-addressed store, hash-verified

1062}
1063
1064static int Lslice_level(lua_State *L) {
1065 lpb_Slice *s = check_lslice(L, 1);
1066 if (!lua_isnoneornil(L, 2)) {
1067 pb_Slice *se;
1068 lua_Integer level = posrelat(luaL_checkinteger(L, 2), s->used);
1069 if (level > (lua_Integer)s->used)
1070 return 0;
1071 else if (level == (lua_Integer)s->used)
1072 se = &s->curr;
1073 else
1074 se = &s->buff[level];
1075 lua_pushinteger(L, (lua_Integer)(se->p - s->buff[0].start) + 1);
1076 lua_pushinteger(L, (lua_Integer)(se->start - s->buff[0].start) + 1);
1077 lua_pushinteger(L, (lua_Integer)(se->end - s->buff[0].start));
1078 return 3;
1079 }
1080 lua_pushinteger(L, s->used);
1081 return 1;
1082}
1083
1084static int Lslice_enter(lua_State *L) {
1085 lpb_Slice *s = check_lslice(L, 1);

Callers

nothing calls this directly

Calls 4

check_lsliceFunction · 0.85
posrelatFunction · 0.85
luaL_checkintegerFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected