> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# comparefunctions

> Compares two function values by their function identity. Both arguments must be functions. The function returns the boolean result of function identity(L, 1) == function identity(L, 2). It does not compare function bytecode, source, behavior, hashes, upvalues, or newcclosure mappings. comparefunction is an alias for the same function.

<div className="real-function-page">
  ```lua theme={null}
  comparefunctions(func1: function, func2: function): boolean
  ```

  ## Aliases

  * `comparefunction`

  ## Arguments

  <ParamField path={"func1"} type={"function"} required>
    First function value to convert with function identity.
  </ParamField>

  <ParamField path={"func2"} type={"function"} required>
    Second function value to convert with function identity.
  </ParamField>

  ## Returns

  <ResponseField name={"equal"} type={"boolean"}>
    true when both function values resolve to the same function identity; otherwise false.
  </ResponseField>

  ## Example

  Compare two functions by their function identity.

  ```lua theme={null}
  local function sample()
      return "ok"
  end

  local same = comparefunctions(sample, sample)
  print(same)
  ```
</div>
