| 244 | |
| 245 | template<typename Stream> |
| 246 | inline int pushDecoded(lua_State* L, Stream& s) { |
| 247 | int top = lua_gettop(L); |
| 248 | values::ToLuaHandler handler(L); |
| 249 | rapidjson::Reader reader; |
| 250 | rapidjson::ParseResult r = reader.Parse(s, handler); |
| 251 | |
| 252 | if (!r) { |
| 253 | lua_settop(L, top); |
| 254 | lua_pushnil(L); |
| 255 | lua_pushfstring(L, "%s (%d)", rapidjson::GetParseError_En(r.Code()), r.Offset()); |
| 256 | return 2; |
| 257 | } |
| 258 | |
| 259 | return 1; |
| 260 | } |
| 261 | |
| 262 | inline int pushDecoded(lua_State* L, const char* ptr, size_t len) { |
| 263 | rapidjson::extend::StringStream s(ptr, len); |
no test coverage detected