Quirrel4.41.0

iostream.blob.readobject

Method of blob, from module "iostream"
instance.readobject([classes: table|null]): any

Deserializes an object from the stream

Parameters

classestable|nullclasses the serialized data is allowed to instantiate optional

Return value

See iostream.stream.readobject for the generic contract.

Notes

Pairing writeobject and readobject on the same in-memory blob round-trips a value without touching a file.

Example

examples/iostream/blob/readobject.nut
from "iostream" import blob

let b = blob(0)
b.writeobject({ a = 1, b = "x" })
b.seek(0)                       // rewind before reading back
let back = b.readobject()
println($"{back.a},{back.b}")
Output:
1,x

See also

readobjectDeserializes an object from the stream
writeobjectSerializes the object to the stream
blobclass index