mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Clarify uniqueness
This commit is contained in:
parent
c014c6a882
commit
0b998a2d43
1 changed files with 2 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
## Summary
|
||||
|
||||
Add `debug.id` which accepts a value and always returns the identifier unique to all values that haven't been garbage collected.
|
||||
Add `debug.id` which accepts a value and always returns the identifier unique to that value.
|
||||
|
||||
## Motivation
|
||||
|
||||
|
@ -12,7 +12,7 @@ When debugging, it is often useful to compare identity. Usually `print` will pri
|
|||
|
||||
## Design
|
||||
|
||||
`debug.id(value: string | userdata | table | thread | function): number` always returns the identifier unique to that value, and is not possible to override. Uniqueness is only guaranteed for values that haven't been garbage collected.
|
||||
`debug.id(value: string | userdata | table | thread | function): number` always returns the identifier unique to that value, and is not possible to override. The identifier can be reused after the value associated with it is garbage collected.
|
||||
|
||||
While tables and userdata have individualized metatables, also allowing functions and threads to be passed to `debug.id` would let their type-level `__tostring` be redefined. Strings are useful to accept because of long, similar strings.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue