Type Functions Type functions are functions that run during analysis time and operate on types, instead of runtime values. They can use the types library to transform existing types or create new ones.
Here’s a simplified implementation of the builtin type function keyof. It takes a table type and returns its property names as a union of singletons.
Type function environmentSection titled “Type function environment”
In addition to the types library, type functions have access to:
assert, error, print
next, ipairs, pairs
select, unpack
getmetatable, setmetatable
rawget, rawset, rawlen, raweq
tonumber, tostring
type, typeof
math library
table library
string library
bit32 library
utf8 library
buffer library
Link preview
GitHub - luau-lang/luau: A small, fast, and embeddable programming language based on Lua with a gradual type system.
A small, fast, and embeddable programming language based on Lua with a gradual type system. - luau-lang/luau GitHub · github.com
Comments