comparefunction
Checks whether two functions are the same underlying function, even when one is a copy.
Syntax
comparefunction(a: function, b: function) -> boolean
Also available as
comparefunctions
Parameters
| Parameter | Type | Description |
|---|---|---|
a | function | The first function. |
b | function | The second function. |
Returns
| Type | Description |
|---|---|
boolean | true when both values run the same code. |
Description
== is only true for the very same value. comparefunction also treats a clonefunction copy as equal to its source, because both run the same prototype or the same native code.
Example
local function f() end
local g = clonefunction(f)
print(f == g)
print(comparefunction(f, g))
print(comparefunction(f, print))
These are Game executor contracts. Check build requirements and session lifetimes before using them.
