ObjDump

Dump an object to memory or save to file for later use. Dumped object can be compressed and encrypted using a password.

OutputVar := ObjDump(Object , Password)
Function Example: DumpBuffer := ObjDump(obj)

Parameters

OutputVar

The name of the variable in which to store the buffer containing dumped object.

Object

The object to be dumped.

Password (optional)

If this parameter is omitted, dumped buffer will not be compressed and not encrypted. If password is an empty string (""), dumped object will be compressed without encryption.

General Remarks

Only following objects and items are supported:


For user defined classes "base" is not saved and can not be restored.
Unsorted Objects, Arrays and Maps are supported too.

Related

ObjLoad

Examples

; Create a simple object
obj := {key:"value",1:"test",2:10}

; Dump an object to variable.
buf := ObjDump(obj)
; Get the dump size of an object 
MsgBox buf.size

; Restore an object from variable
obj := ObjLoad(buf)

; Dump an object to file
f:=FileOpen(A_ScriptDir "\MyDump.bin","w -rwd")
f.RawWrite(ObjDump(obj)),f.Close()

; Restore an object from file
obj := ObjLoad(A_ScriptDir "\MyDump.bin")