> ## 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

> So sánh hai function values bằng function identity của chúng. Cả hai arguments phải là functions. Function trả về boolean result của function identity(L, 1) == function identity(L, 2). Function không so sánh function bytecode, source, behavior, hashes, upvalues hoặc newcclosure mappings. comparefunction là alias cho cùng function.

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

  ## Alias

  * `comparefunction`

  ## Đối số

  <ParamField path={"func1"} type={"function"} required>
    First function value được chuyển đổi bằng function identity.
  </ParamField>

  <ParamField path={"func2"} type={"function"} required>
    Second function value được chuyển đổi bằng function identity.
  </ParamField>

  ## Giá trị trả về

  <ResponseField name={"equal"} type={"boolean"}>
    true khi cả hai function values resolve thành cùng một function identity; ngược lại false.
  </ResponseField>

  ## Ví dụ

  Compare two functions by their function identity.

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

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