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

# clonefunction

> Creates and returns a separate function value for the function passed as the first argument. The argument must be a function.

<div className="real-function-page">
  ```lua theme={null}
  clonefunction(func: function): function
  ```

  ## Аргументы

  <ParamField path={"func"} type={"function"} required>
    Function to clone. Passing a non-function raises a type error.
  </ParamField>

  ## Возвраты

  <ResponseField name={"clone"} type={"function"}>
    New function produced by the newcclosure, C closure, or Luau closure clone path.
  </ResponseField>

  ## Пример

  Create a cloned closure from a function.

  ```lua theme={null}
  local function greet(name)
      return "Hello, " .. name
  end

  local cloned = clonefunction(greet)
  print(cloned("Real"))
  ```
</div>
