On this page

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

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 — the string to hash

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(v: 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

  • v: unknown — value to print