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

Function lpbD_message

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

Source from the content-addressed store, hash-verified

1857}
1858
1859static int lpbD_message(lpb_Env *e, const pb_Type *t) {
1860 lua_State *L = e->L;
1861 pb_Slice *s = e->s;
1862 uint32_t tag;
1863 luaL_checkstack(L, t->field_count * 2, "not enough stack space for fields");
1864 while (pb_readvarint32(s, &tag)) {
1865 const pb_Field *f = pb_field(t, pb_gettag(tag));
1866 if (f == NULL)
1867 pb_skipvalue(s, tag);
1868 else if (f->type && f->type->is_map) {
1869 lpb_fetchtable(e, f);
1870 lpbD_checktype(e, f, tag);
1871 lpbD_map(e, f);
1872 lua_pop(L, 1);
1873 } else if (f->repeated) {
1874 lpb_fetchtable(e, f);
1875 lpbD_repeated(e, f, tag);
1876 lua_pop(L, 1);
1877 } else {
1878 lua_pushstring(L, (const char*)f->name);
1879 if (f->oneof_idx) {
1880 lua_pushstring(L, (const char*)pb_oneofname(t, f->oneof_idx));
1881 lua_pushvalue(L, -2);
1882 lua_rawset(L, -4);
1883 }
1884 lpbD_field(e, f, tag);
1885 lua_rawset(L, -3);
1886 }
1887 }
1888 if (e->LS->use_dec_hooks) lpb_usedechooks(L, e->LS, t);
1889 return 1;
1890}
1891
1892static int lpbD_decode(lua_State *L, pb_Slice s, int start) {
1893 lpb_State *LS = lpb_lstate(L);

Callers 2

lpbD_rawfieldFunction · 0.85
lpbD_decodeFunction · 0.85

Calls 14

luaL_checkstackFunction · 0.85
pb_readvarint32Function · 0.85
pb_fieldFunction · 0.85
pb_skipvalueFunction · 0.85
lpb_fetchtableFunction · 0.85
lpbD_checktypeFunction · 0.85
lpbD_mapFunction · 0.85
lpbD_repeatedFunction · 0.85
lua_pushstringFunction · 0.85
pb_oneofnameFunction · 0.85
lua_pushvalueFunction · 0.85
lua_rawsetFunction · 0.85

Tested by

no test coverage detected