| 66 | } |
| 67 | |
| 68 | Value ObjectValue(lua_State* L, int idx, int depth, Allocator& allocator) |
| 69 | { |
| 70 | Value object(rapidjson::kObjectType); |
| 71 | idx = luax::absindex(L, idx); |
| 72 | lua_pushnil(L); // [nil] |
| 73 | while (lua_next(L, idx)) |
| 74 | { |
| 75 | // [key, value] |
| 76 | if (lua_type(L, -2) == LUA_TSTRING) |
| 77 | { |
| 78 | object.AddMember(StringValue(L, -2, allocator), toValue(L, -1, depth, allocator), allocator); |
| 79 | } |
| 80 | |
| 81 | // pop value, leaving original key |
| 82 | lua_pop(L, 1); |
| 83 | // [key] |
| 84 | } |
| 85 | // [] |
| 86 | |
| 87 | return object; |
| 88 | } |
| 89 | |
| 90 | Value ArrayValue(lua_State* L, int idx, int depth, Allocator& allocator) |
| 91 | { |
no test coverage detected