Closures

comparefunctions

Checks whether two function references point to the same underlying closure.

Syntax

comparefunctions(func1: function, func2: function): boolean
Aliases comparefunction

Arguments

NameTypeDescription
func1functionFirst function to compare.
func2functionSecond function to compare.

Returns

NameTypeDescription
equalbooleanTrue when both inputs resolve to the same underlying object or function.

Description

Checks whether two function references point to the same underlying closure.

Call it with 2 parameter(s): func1, func2. The argument table explains which values are required and which ones only refine the behavior.

It returns equal (boolean). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Example call with placeholder values.

local result = comparefunctions(function() end, function() end)
print(result)