The Closures library classifies, wraps, hooks, restores, and compares Luau closures. Most tooling that touches remotes or the game’s own functions is built on it, so the pages here are precise about the distinctions that matter.

Two kinds of closure

Luau has two closure representations, and several functions here only make sense once you can tell them apart. Only Luau closures have bytecode, constants, upvalue refs, and a hash. The functions that read those, getfunctionhash and the bytecode-based debug functions, reject C closures for that reason.

Functions

Narrowing a hook

hookfunction and hookmetamethod both take an optional filter. A filtered hook runs your Luau only for the calls that match; everything else is forwarded to the original natively. That is worth reaching for on __namecall, which otherwise runs your hook for every method call in the game.

Aliases

Several functions are also registered under their common alternate names, so scripts written for other environments run unchanged.