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
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.
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