Link Search Menu Expand Document

Asset

Represents data that can be shared to other clients in the Alloverse

An asset is just raw data.

Constructor

 asset = Asset(data)

Arguments

Name Type Description
data string Raw data for the asset.

Returns

Nothing


Methods

Asset:read (offset, length)

Read a part of the data

Arguments

Name Type Description
offset number The byte to start reading from
length number The number of bytes to read

Returns

Type Description
string the requested data

Asset:write (data, offset, totalSize)

Write a part of the data

Arguments

Name Type Description
data string The data buffering
offset number The byte offset to start writing at
totalSize number The expected total size of the asset.

Returns

Nothing


Asset:size ()

Returns the size of the asset

Arguments

None

Returns

Type Description
number The size of the data

Asset:id (refresh)

Returns a computed unique identifier for this asset The id is a hash of the asset data. This ensures the same asset identifier is always matched with the same data

Arguments

Name Type Description
refresh boolean By default a cached hash is returned, if one is available. Send refresh to true to recompute the id

Returns

Nothing