Fixed rawget example

This commit is contained in:
Junseo Yoo 2024-07-03 14:47:48 -07:00
parent 3babf9bfab
commit f2685c315b

View file

@ -25,12 +25,12 @@ end
For instance, the `rawget` type function can be written as: For instance, the `rawget` type function can be written as:
```luau ```luau
type function rawget(tbl, prop) type function rawget(tbl, prop)
if typelib.isunion(prop) then if typelib.isunion(tbl) or typelib.isunion(prop) then
print("Warning: union types are not supported!") -- output a warning print("Warning: union types are not supported!") -- outputs a warning
end end
if not typelib.istable(tbl) or not (typelib.isstringsingleton(prop) || typelib.isbooleansingleton(prop)) then if not typelib.istable(tbl) then
error("The parameters of rawget type function is wrong!") -- fails to reduce error("First argument is not a table!") -- fails to reduce
end end
return tbl:getprops()[prop:getvalue()] return tbl:getprops()[prop:getvalue()]