Functions and constants to access resources.

Static methods

staticatlas(path:String):AtlasResourceReference

Constructor-like function with two purposes:

  • Load the specified resource as part of loading the script
  • Return a hash to the run-time version of the resource

Note: This function can only be called within @property().

staticfont(path:String):FontResourceReference

Constructor-like function with two purposes:

  • Load the specified resource as part of loading the script
  • Return a hash to the run-time version of the resource

Note: This function can only be called within @property().

staticget_buffer(path:HashOrString):Buffer

Gets the buffer from a resource

Parameters:

path

The path to the resource

Returns:

The resource buffer

staticget_current_manifest():ResourceManifestReference

Return a reference to the Manifest that is currently loaded.

Returns:

reference to the Manifest that is currently loaded

staticis_using_liveupdate_data():Bool

Is any liveupdate data mounted and currently in use? This can be used to determine if a new manifest or zip file should be downloaded.

Returns:

true if a liveupdate archive (any format) has been loaded

staticload(path:String):Buffer

Loads the resource data for a specific resource.

Parameters:

path

The path to the resource

Returns:

the buffer stored on disc

staticmaterial():MaterialResourceReference

Constructor-like function with two purposes:

  • Load the specified resource as part of loading the script
  • Return a hash to the run-time version of the resource

Note: This function can only be called within @property().

staticset(path:HashOrString, buffer:Buffer):Void

Sets the resource data for a specific resource

Parameters:

path

The path to the resource

The

buffer of precreated data, suitable for the intended resource type

staticset_buffer(path:HashOrString, buffer:Buffer):Void

Sets the buffer of a resource

Parameters:

path

The path to the resource

buffer

The resource buffer

staticset_texture(path:HashOrString, table:ResourceTextureInfo, buffer:Buffer):Void

Sets the pixel data for a specific texture.

Parameters:

path

The path to the resource

table

A table containing info about the texture

buffer

The buffer of precreated pixel data NOTE Currently, only 1 mipmap is generated.

staticstore_archive<T>(path:String, callback:(self:T, status:ResourceLiveUpdateStatus) ‑> Void):Void

Stores a zip file and uses it for live update content. The path is renamed and stored in the (internal) live update location.

Parameters:

path

the path to the original file on disc

callback

the callback function executed after the storage has completed

staticstore_manifest<T>(manifest_buffer:String, callback:(self:T, status:ResourceLiveUpdateStatus) ‑> Void):Void

Create, verify, and store a manifest to device.

Create a new manifest from a buffer. The created manifest is verified by ensuring that the manifest was signed using the bundled public/private key-pair during the bundle process and that the manifest supports the current running engine version. Once the manifest is verified it is stored on device. The next time the engine starts (or is rebooted) it will look for the stored manifest before loading resources. Storing a new manifest allows the developer to update the game, modify existing resources, or add new resources to the game through LiveUpdate.

Parameters:

manifest_buffer

the binary data that represents the manifest

callback

the callback function executed once the engine has attempted to store the manifest.

staticstore_resource<T>(manifest_reference:ResourceManifestReference, data:String, hexdigest:String, callback:(T, String, Bool) ‑> Void):Void

Add a resource to the data archive and runtime index.

The resource will be verified internally before being added to the data archive.

Parameters:

manifest_reference

The manifest to check against.

data

The resource data that should be stored.

hexdigest

The expected hash for the resource, retrieved through collectionproxy.missing_resources.

callback

The callback function that is executed once the engine has been attempted to store the resource. Arguments: self The current object. hexdigest The hexdigest of the resource. * status Whether or not the resource was successfully stored.

statictexture(path:String):TextureResourceReference

Constructor-like function with two purposes:

  • Load the specified resource as part of loading the script
  • Return a hash to the run-time version of the resource

Note: This function can only be called within @property().

statictile_source(path:String):TileSourceResourceReference

Constructor-like function with two purposes:

  • Load the specified resource as part of loading the script
  • Return a hash to the run-time version of the resource

Note: This function can only be called within @property().