Skip to Content
defold-typescript
Get startedGuidesAPILibraries
Globals

globals

The functions Defold exposes to every script without a namespace prefix. The global types (Hash, Vector3, ...) have their own reference pages. The Lua base globals (print, pcall, pairs, assert, ...) come from the lua-types dependency and are documented on the base reference page, not duplicated here.

Functions

hash(s: string | Hash): Hash

Hashes a string into a hash value. The hash can be used to reference resources and identifiers in the Defold engine without carrying the original string around.

Parameters

  • s: string | Hash — the string to hash, or a hash value, which is returned unchanged

Returns

  • hash: Hash — the hash value

hash_to_hex(h: Hash): string

Returns a hexadecimal representation of a hash value. The returned string is always padded with leading zeros.

Parameters

  • h: Hash — hash value to get hex string for

Returns

  • hex: string — hex representation of the hash

pprint(...args: unknown)

Pretty printing of Lua values. This function prints Lua values in a manner similar to +print()+, but will also recurse into tables and pretty print their contents.

Parameters

  • ...args: unknown — values to print

On this page