Type Functions | Luau<br>Skip to content Search CtrlK Cancel
GitHubRSS Feed<br>Select theme DarkLightAuto
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 environment<br>Section 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