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

Function lpbE_map

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

Source from the content-addressed store, hash-verified

1587}
1588
1589static void lpbE_map(lpb_Env *e, const pb_Field *f, int idx) {
1590 lua_State *L = e->L;
1591 const pb_Field *kf = pb_field(f->type, 1);
1592 const pb_Field *vf = pb_field(f->type, 2);
1593 if (kf == NULL || vf == NULL) return;
1594 lpb_checktable(L, f, idx);
1595 lua_pushnil(L);
1596 while (lua_next(L, lpb_relindex(idx, 1))) {
1597 size_t len;
1598 pb_addvarint32(e->b, pb_pair(f->number, PB_TBYTES));
1599 len = pb_bufflen(e->b);
1600 lpbE_tagfield(e, kf, 1, -2);
1601 lpbE_tagfield(e, vf, 1, -1);
1602 lpb_addlength(L, e->b, len);
1603
1604 lua_pop(L, 1);
1605 }
1606}
1607
1608static void lpbE_repeated(lpb_Env *e, const pb_Field *f, int idx) {
1609 lua_State *L = e->L;

Callers 1

lpb_encode_onefieldFunction · 0.85

Calls 8

pb_fieldFunction · 0.85
lpb_checktableFunction · 0.85
lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
lpb_relindexFunction · 0.85
pb_addvarint32Function · 0.85
lpbE_tagfieldFunction · 0.85
lpb_addlengthFunction · 0.85

Tested by

no test coverage detected