mirror of
https://github.com/luau-lang/rfcs.git
synced 2025-05-04 10:43:48 +01:00
Update docs/metatable-type-functions.md
Co-authored-by: ariel <aweiss@hey.com>
This commit is contained in:
parent
74d1fe2682
commit
71b58dc82d
1 changed files with 3 additions and 2 deletions
|
@ -70,8 +70,9 @@ type metatable = {
|
||||||
type MetatableType = getmetatable<setmetatable<{}, metatable>>
|
type MetatableType = getmetatable<setmetatable<{}, metatable>>
|
||||||
```
|
```
|
||||||
|
|
||||||
If the type passed into the type function doesn't have a metatable and it *could* have a metatable (so primitives, singletons, classes, and tables), then it will return nil.
|
If the type passed in does not support metatables in the type system (i.e. at the time of writing, is not any of a primitive, a singleton, a class, a table, or a union or intersection thereof), it should error when passed to `getmetatable`.
|
||||||
If the type passed in is an intersection or union, then it will return an intersection or union respectively.
|
If the type passed in is an intersection or union of things that support metatables, then it will return an intersection or union of those metatables respectively.
|
||||||
|
If no metatable is present, but the type system supports metatables for that type, it should return the `nil` type indicating that there is no metatable present.
|
||||||
|
|
||||||
## Drawbacks
|
## Drawbacks
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue