MCPcopy Create free account
hub / github.com/OpenMW/openmw / deserialize

Function deserialize

components/lua/serialization.cpp:369–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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}

Callers 7

getCopyMethod · 0.70
getReadOnlyMethod · 0.70
loadMethod · 0.70
receiveEventMethod · 0.70
callOnInitMethod · 0.70
loadMethod · 0.70

Calls 3

to_stringFunction · 0.85
deserializeImplFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected