Mtasa-blue: serializeElement, deserializeElement

Created on 21 Jan 2020  路  7Comments  路  Source: multitheftauto/mtasa-blue

Is your feature request related to a problem? Please describe.
You have to write your save/load systems for scratch

Describe the solution you'd like
function serializeElement will convert almost any element to string, json with all information with option to skip some data, deserializeElement will create element base on json input. It makes very easy way to save/load elements ( example vehicle ) from and to database where you just carry only about your custom stuff.

Describe alternatives you've considered
/

Additional context
It will save a lot of time for programmers

enhancement

Most helpful comment

I don't really want to maintain something like this. cloneElement is already a pain in the arse

Plus this can be done in Lua

All 7 comments

I don't really want to maintain something like this. cloneElement is already a pain in the arse

Plus this can be done in Lua

Does https://wiki.multitheftauto.com/wiki/SaveMapData work for you? we already support serialising to XML

nope

Why not?

because i have to create some xml file which will retrive data, then convert it back to json and vice versa, it doesn't return data ready to save

Tbh it would be kinda useful and at least serializeElement should be easy to make, right?

because i have to create some xml file which will retrive data, then convert it back to json and vice versa, it doesn't return data ready to save

It might support writing to an in-memory xml node created by xmlLoadString, and we could add a feature to get an XML string without writing to a file, but I don't think we're going to maintain JSON as a serialisation method, sorry.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Cazomino05 picture Cazomino05  路  3Comments

patrikjuvonen picture patrikjuvonen  路  3Comments

CrosRoad95 picture CrosRoad95  路  4Comments

CrosRoad95 picture CrosRoad95  路  4Comments

Haxardous picture Haxardous  路  3Comments