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.