| 367 | } |
| 368 | |
| 369 | sol::object deserialize( |
| 370 | lua_State* lua, std::string_view binaryData, const UserdataSerializer* customSerializer, bool readOnly) |
| 371 | { |
| 372 | if (binaryData.empty()) |
| 373 | return sol::nil; |
| 374 | if (binaryData[0] != FORMAT_VERSION) |
| 375 | throw std::runtime_error("Incorrect version of Lua serialization format: " |
| 376 | + std::to_string(static_cast<unsigned>(binaryData[0]))); |
| 377 | binaryData = binaryData.substr(1); |
| 378 | deserializeImpl(lua, binaryData, customSerializer, readOnly); |
| 379 | if (!binaryData.empty()) |
| 380 | throw std::runtime_error("Unexpected data after serialized object"); |
| 381 | return sol::stack::pop<sol::object>(lua); |
| 382 | } |
| 383 | |
| 384 | } |
no test coverage detected