Syntax
getfunctionhash(func: function): string | nilArguments
| Name | Type | Description |
|---|---|---|
func | function | Luau function to hash. Passing a C closure raises "Lua function expected". |
Returns
| Name | Type | Description |
|---|---|---|
hash | string | nil | Uppercase SHA384 hex digest string, or nil if no hashable function content is available. |
Description
Returns an uppercase SHA384 hex digest derived from a Luau function. The argument must be a function, and C closures raise "Lua function expected". If no hashable function content is available, the function returns nil.
Call it with 1 parameter(s): func. The argument table explains which values are required and which ones only refine the behavior.
It returns hash (string | nil). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Hash the Proto bytes for a Luau function closure.
local function sample(value)
return value + 1
end
local hash = getfunctionhash(sample)
print(hash)