Dump an object to memory or save to file for later use.
OutputVar := ObjDump(ObjectOrPath , DumpToVar, Compress, Password)Function Example: size := ObjDump(obj, var)
The name of the variable in which to store the size of dumped object.
The object to be dumped to memory.
To save the object to a file this parameter must be the file path and DumpToVar parameter the object, see Examples.
The name of the variable in which to store Buffer object. When this parameter is omitted only the size will be returned.
When saving the object to a file this parameter will be the object and ObjOrPath the file path.
If this parameter is not NULL || FALSE || 0, then dumped object will be compressed.
When dumped object is compressed this parameter can be a passwords to use for dumped object, no password can be used if Compress parameter is NULL || FALSE || 0!
Only following data is saved: for Objects its properties, for Maps its items, for Arrays its values, buffer in BufferObjects and Structs which are converted to Map. Other types of Objects are not supported.
The "base" reference is not saved and can not be restored.
; Create a simple object obj := {key:"value",1:"test",2:10} ; Dump an object to variable. sz := ObjDump(obj, var) ; Restore an object from variable obj := ObjLoad(var.Ptr) ; Dump an object to file sz := ObjDump(A_ScriptDir "\MyDump.bin", obj) ; Restore an object from file obj := ObjLoad(A_ScriptDir "\MyDump.bin") ; Get the dump size of an object MsgBox % ObjDump(obj)