From a22eb205dd7fd805cfaabc40c64ace9462cd5917 Mon Sep 17 00:00:00 2001 From: Junseo Yoo Date: Tue, 11 Jun 2024 15:33:33 -0700 Subject: [PATCH] Added a note about how this type operator doesn't work with class types --- docs/rawget-type-operator.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/rawget-type-operator.md b/docs/rawget-type-operator.md index 4b37006..4e2c778 100644 --- a/docs/rawget-type-operator.md +++ b/docs/rawget-type-operator.md @@ -36,6 +36,8 @@ local key = "property" type age = rawget -- Error message: Second argument to rawget is not a valid index type; Unknown type 'key' ``` +Note: `rawget` type operator does not work on class types because they do not have direct fields that can be looked up without invoking its metamethod. + The implementation effort for this type operator is very minimal. Since the `rawget` type operator functions similarly to the `index` type operator, we can reuse the functions already used to implement the `index` type operator. ## Drawbacks