value to convert is on top of stack
| 5504 | |
| 5505 | // value to convert is on top of stack |
| 5506 | static cson_value *table_to_cson_array(Lua L, int lvl, json_conv *conv) |
| 5507 | { |
| 5508 | cson_value *v = cson_value_new_array(); |
| 5509 | cson_array *a = cson_value_get_array(v); |
| 5510 | int n = luaL_getn(L, -1); |
| 5511 | for (int i = 0; i < n; ++i) { |
| 5512 | lua_rawgeti(L, -1, i + 1); |
| 5513 | cson_value *val = table_to_cson(L, lvl, conv); |
| 5514 | if (val == NULL) { |
| 5515 | cson_free_value(v); |
| 5516 | return NULL; |
| 5517 | } |
| 5518 | cson_array_append(a, val); |
| 5519 | lua_pop(L, 1); |
| 5520 | } |
| 5521 | return v; |
| 5522 | } |
| 5523 | |
| 5524 | // value to convert is on top of stack |
| 5525 | static cson_value *table_to_cson_object(Lua L, int lvl, json_conv *conv) |
no test coverage detected