| 1235 | } |
| 1236 | |
| 1237 | static int lpb_pushfield(lua_State *L, const pb_Type *t, const pb_Field *f) { |
| 1238 | if (f == NULL) return 0; |
| 1239 | lua_pushstring(L, (const char*)f->name); |
| 1240 | lua_pushinteger(L, f->number); |
| 1241 | lua_pushstring(L, f->type ? |
| 1242 | (const char*)f->type->name : |
| 1243 | pb_typename(f->type_id, "<unknown>")); |
| 1244 | lua_pushstring(L, (const char*)f->default_value); |
| 1245 | lua_pushstring(L, f->repeated ? |
| 1246 | (f->packed ? "packed" : "repeated") : |
| 1247 | "optional"); |
| 1248 | if (f->oneof_idx > 0) { |
| 1249 | lua_pushstring(L, (const char*)pb_oneofname(t, f->oneof_idx)); |
| 1250 | lua_pushinteger(L, f->oneof_idx-1); |
| 1251 | return 7; |
| 1252 | } |
| 1253 | return 5; |
| 1254 | } |
| 1255 | |
| 1256 | static int Lpb_typesiter(lua_State *L) { |
| 1257 | lpb_State *LS = lpb_lstate(L); |
no test coverage detected