| 1366 | } |
| 1367 | |
| 1368 | static 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 | |
| 1382 | static void lpb_pushdefmeta(lua_State *L, lpb_State *LS, const pb_Type *t) { |
| 1383 | lpb_pushdeftable(L, LS); |
no test coverage detected