Volt

getfunctionhash

Returns a hash of the function's bytecode.

Syntax

getfunctionhash(func: function) -> string

Parameters

ParameterTypeDescription
funcfunctionThe function to hash

Returns

TypeDescription
stringA hash string representing the function's bytecode

Description

getfunctionhash generates a unique hash based on the function's compiled bytecode. Functions with identical source code will produce the same hash, making this useful for identifying and comparing functions.

Example

local function testFunc()
    return 1 + 1
end

local hash = getfunctionhash(testFunc)
print(hash) -- Output: something like "a1b2c3d4..."

-- Same code produces same hash
local function testFunc2()
    return 1 + 1
end

print(getfunctionhash(testFunc2) == hash) -- true

Notes

  • Only works with Luau closures (not C closures)
  • Slight changes in function bytecode will alter the returned hash

On this page