Reworded for better clarity

Co-authored-by: aaron <aweiss@hey.com>
This commit is contained in:
Junseo Yoo 2024-06-10 14:01:16 -07:00 committed by GitHub
parent d3b99419a3
commit fd8f36cd8a
Signed by: DevComp
GPG key ID: B5690EEEBB952194

View file

@ -76,7 +76,7 @@ type idxType3 = index<Person | Person2, "age"> -- idxType3 = number | string
type idxType4 = index<Person | Person2, "alive" | "age"> -- Error message: Property '"age" | "alive"' does not exist on type 'Person | Person2' type idxType4 = index<Person | Person2, "alive" | "age"> -- Error message: Property '"age" | "alive"' does not exist on type 'Person | Person2'
``` ```
In the circumstance that the indexee is a type class or table with an `__index` metamethod, the `__index` metamethod will *only* be invoked if the indexer is not found within the current scope: In the circumstance that the indexee's type is a class or table with an `__index` metamethod, the `__index` metamethod will *only* be invoked if the indexer is not found within the current scope:
```luau ```luau
local exampleClass = { Foo = "eight" } local exampleClass = { Foo = "eight" }
local exampleClass2 = setmetatable({ Foo = 8 }, { __index = exampleClass }) local exampleClass2 = setmetatable({ Foo = 8 }, { __index = exampleClass })