**This is an old revision of the document!**

Guid API

The guid API is used to create 128 bit random identifiers and convert numbers to hex strings.

  • guid.next() string

    Returns The guid API is used to create 128 bit random identifiers, represented as 32 hex values in a string grouped by 8, 4, 4, 4, and 12 hex characters, separated by dashes.

    e.g. 34eb7b28-14d3-4767-b326-dd1609ba92e. You might recognize this pattern as it is the same used for component addressing.

  • guid.toHex(number) string

    Converts number to a hexadecimal representation, returning it as a string.

snippet.lua
local hex = guid.toHex(1234)
print(type(hex), hex) -- string, 4d2