This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
api:guid [2016/06/20 01:06] payonel |
api:guid [2016/07/08 06:01] (current) payonel |
||
---|---|---|---|
Line 2: | Line 2: | ||
--------- | --------- | ||
- | The guid API is used to create 128 bit random identifiers and convert numbers to hex strings. | + | Renamed to [[api:uuid|uuid]] |
- | + | ||
- | * ''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. | + | |
- | + | ||
- | ```lua | + | |
- | local hex = guid.toHex(1234) | + | |
- | print(type(hex), hex) -- string, 4d2 | + | |
- | ``` | + | |
- | | + |