liveupdate
Functions and constants to access resources.
Functions
liveupdate.add_mount(name: string | Hash, uri: string, priority: number, callback: (self: unknown, name: Hash, uri: string, result: liveupdate.LiveUpdate) => void):liveupdate.LiveUpdateCliveupdate.get_mounts(): ({ name: Hash; uri: string; priority: number })[]liveupdate.is_built_with_excluded_files(): booleanNliveupdate.remove_mount(name: string | Hash):liveupdate.LiveUpdateC
liveupdate.add_mount(name: string | Hash, uri: string, priority: number, callback: (self: unknown, name: Hash, uri: string, result: liveupdate.LiveUpdate) => void): liveupdate.LiveUpdateC
Signature changed in Defold 1.13.0 — before:
(name: string, uri: string, priority: number, callback: (...args: unknown[]) => unknown): number
Adds a resource mount to the resource system. After the mount succeeded, the resources are available to load. (i.e. no reboot required)
// Add multiple mounts. Higher priority takes precedence.
liveupdate.add_mount("common", "zip:/path/to/common_stuff.zip", 10, (result) => {}); // base pack
liveupdate.add_mount("levelpack_1", "zip:/path/to/levels_1_to_20.zip", 20, (result) => {}); // level pack
liveupdate.add_mount("season_pack_1", "zip:/path/to/easter_pack_1.zip", 30, (result) => {}); // season pack, overriding content in the other packsliveupdate.add_mount("common", "zip:/path/to/common_stuff.zip", 10, function (self, name, uri, result) end) -- base pack
liveupdate.add_mount("levelpack_1", "zip:/path/to/levels_1_to_20.zip", 20, function (self, name, uri, result) end) -- level pack
liveupdate.add_mount("season_pack_1", "zip:/path/to/easter_pack_1.zip", 30, function (self, name, uri, result) end) -- season pack, overriding content in the other packsParameters
name:string | Hash— Unique name of the mounturi:string— The uri of the mount, including the scheme. Currently supported schemes are 'zip' and 'archive'.priority:number— Priority of mount. Larger priority takes prescedencecallback:(self: unknown, name: Hash, uri: string, result: liveupdate.LiveUpdate) => void— Callback after the asynchronous request completednamehash Unique name of the mounturistring The uri of the mountresultliveupdate.LIVEUPDATE The result of the request
Returns
result:liveupdate.LiveUpdate— The result of the request
liveupdate.get_mounts(): ({ name: Hash; uri: string; priority: number })[]
Get an array of the current mounts This can be used to determine if a new mount is needed or not
Output the current resource mounts
pprint("MOUNTS", liveupdate.get_mounts());pprint("MOUNTS", liveupdate.get_mounts())Give an output like:
// DEBUG:SCRIPT: MOUNTS,
// {
// 1 = {
// name = hash: [liveupdate],
// uri = "zip:/device/path/to/acchives/liveupdate.zip",
// priority = 5
// },
// 2 = {
// name = hash: [_base],
// uri = "archive:build/default/game.dmanifest",
// priority = -10
// }
// }DEBUG:SCRIPT: MOUNTS,
{ --[[0x119667bf0]]
1 = { --[[0x119667c50]]
name = hash: [liveupdate],
uri = "zip:/device/path/to/acchives/liveupdate.zip",
priority = 5
},
2 = { --[[0x119667d50]]
name = hash: [_base],
uri = "archive:build/default/game.dmanifest",
priority = -10
}
}Returns
mounts:({ name: Hash; uri: string; priority: number })[]— Array of mounts
liveupdate.is_built_with_excluded_files(): booleanN
- Since Defold 1.13.0
Checks if the bundled application was built with one or more resources
excluded from the main bundle, through a collection proxy with
Exclude enabled.
This value is based on metadata in the bundled manifest. It does not check
whether any live update archive has been mounted or whether the excluded
resources are currently available on device.
if (liveupdate.is_built_with_excluded_files()) print("The bundle expects live update content.");if liveupdate.is_built_with_excluded_files() then
print("The bundle expects live update content.")
endReturns
is_built_with_excluded_files:boolean— true if the bundled application was built with excluded files
liveupdate.remove_mount(name: string | Hash): liveupdate.LiveUpdateC
Signature changed in Defold 1.13.0 — before:
(name: string): number
Remove a mount the resource system. Removing a mount does not affect any loaded resources.
// Add multiple mounts. Higher priority takes precedence.
liveupdate.remove_mount("season_pack_1");liveupdate.remove_mount("season_pack_1")Parameters
name:string | Hash— Unique name of the mount
Returns
result:liveupdate.LiveUpdate— The result of the call
Constants
liveupdate.LIVEUPDATE_BUNDLED_RESOURCE_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_BUNDLED_RESOURCE_MISMATCH" }
Mismatch between between expected bundled resources and actual bundled resources. The manifest expects a resource to be in the bundle, but it was not found in the bundle. This is typically the case when a non-excluded resource was modified between publishing the bundle and publishing the manifest.
liveupdate.LIVEUPDATE_ENGINE_VERSION_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_ENGINE_VERSION_MISMATCH" }
Mismatch between running engine version and engine versions supported by manifest.
liveupdate.LIVEUPDATE_FORMAT_ERROR: number & { readonly __brand: "liveupdate.LIVEUPDATE_FORMAT_ERROR" }
Failed to parse manifest data buffer. The manifest was probably produced by a different engine version.
liveupdate.LIVEUPDATE_INVAL: number & { readonly __brand: "liveupdate.LIVEUPDATE_INVAL" }
Argument was invalid
liveupdate.LIVEUPDATE_INVALID_HEADER: number & { readonly __brand: "liveupdate.LIVEUPDATE_INVALID_HEADER" }
The handled resource is invalid.
liveupdate.LIVEUPDATE_INVALID_RESOURCE: number & { readonly __brand: "liveupdate.LIVEUPDATE_INVALID_RESOURCE" }
The header of the resource is invalid.
liveupdate.LIVEUPDATE_IO_ERROR: number & { readonly __brand: "liveupdate.LIVEUPDATE_IO_ERROR" }
I/O operation failed
liveupdate.LIVEUPDATE_MEM_ERROR: number & { readonly __brand: "liveupdate.LIVEUPDATE_MEM_ERROR" }
Memory wasn't allocated
liveupdate.LIVEUPDATE_OK: number & { readonly __brand: "liveupdate.LIVEUPDATE_OK" }
Operation completed successfully.
liveupdate.LIVEUPDATE_SCHEME_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_SCHEME_MISMATCH" }
Mismatch between scheme used to load resources. Resources are loaded with a different scheme than from manifest, for example over HTTP or directly from file. This is typically the case when running the game directly from the editor instead of from a bundle.
liveupdate.LIVEUPDATE_SIGNATURE_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_SIGNATURE_MISMATCH" }
Mismatch between expected and actual integrity data for legacy liveupdate verification.
liveupdate.LIVEUPDATE_UNKNOWN: number & { readonly __brand: "liveupdate.LIVEUPDATE_UNKNOWN" }
Unspecified error
liveupdate.LIVEUPDATE_VERSION_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_VERSION_MISMATCH" }
Mismatch between manifest expected version and actual version.