From f2685c315bade4161b419bcd9b7866f10677a0a6 Mon Sep 17 00:00:00 2001 From: Junseo Yoo Date: Wed, 3 Jul 2024 14:47:48 -0700 Subject: [PATCH] Fixed rawget example --- docs/user-defined-type-functions.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/user-defined-type-functions.md b/docs/user-defined-type-functions.md index 64d84e1..38803f3 100644 --- a/docs/user-defined-type-functions.md +++ b/docs/user-defined-type-functions.md @@ -25,12 +25,12 @@ end For instance, the `rawget` type function can be written as: ```luau type function rawget(tbl, prop) - if typelib.isunion(prop) then - print("Warning: union types are not supported!") -- output a warning + if typelib.isunion(tbl) or typelib.isunion(prop) then + print("Warning: union types are not supported!") -- outputs a warning end - if not typelib.istable(tbl) or not (typelib.isstringsingleton(prop) || typelib.isbooleansingleton(prop)) then - error("The parameters of rawget type function is wrong!") -- fails to reduce + if not typelib.istable(tbl) then + error("First argument is not a table!") -- fails to reduce end return tbl:getprops()[prop:getvalue()]