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

Function lpb_setdeffields

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

Source from the content-addressed store, hash-verified

1366}
1367
1368static void lpb_setdeffields(lua_State *L, lpb_State *LS, const pb_Type *t, lpb_DefFlags flags) {
1369 const pb_Field *f = NULL;
1370 while (pb_nextfield(t, &f)) {
1371 int has_field = f->repeated ?
1372 (flags & USE_REPEAT) && (t->is_proto3 || LS->decode_default_array)
1373 && (lua_newtable(L), 1) :
1374 !f->oneof_idx && (f->type_id != PB_Tmessage ?
1375 (flags & USE_FIELD) :
1376 (flags & USE_MESSAGE) && LS->decode_default_message)
1377 && lpb_pushdeffield(L, LS, f, t->is_proto3);
1378 if (has_field) lua_setfield(L, -2, (const char*)f->name);
1379 }
1380}
1381
1382static void lpb_pushdefmeta(lua_State *L, lpb_State *LS, const pb_Type *t) {
1383 lpb_pushdeftable(L, LS);

Callers 2

lpb_pushdefmetaFunction · 0.85
lpb_pushtypetableFunction · 0.85

Calls 3

pb_nextfieldFunction · 0.85
lpb_pushdeffieldFunction · 0.85
lua_setfieldFunction · 0.85

Tested by

no test coverage detected