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

# hookmetamethod

> Bir value üzerinde metamethod function arar ve bu function değerini hookfunction üzerinden hook eder. First argument, raw metafield lookup tarafından kabul edilen herhangi bir value olabilir. Second argument string metamethod name olmalı ve third argument function replacement olmalıdır. raw metafield lookup named metafield bulamazsa function argument 2 için "Metamethod doesn't exist" üretir. Metafield varsa ancak function değilse argument 2 için "Metamethod isn't a function" üretir. Metafield function olduğunda hookmetamethod, found metamethod function değerini target olarak hookfunction çağırır ve hookfunction cloned original closure değerini döndürür.

<div className="real-function-page">
  ```lua theme={null}
  hookmetamethod(object: any, metamethod: string, replacement: function): function
  ```

  ## Argümanlar

  <ParamField path={"object"} type={"any"} required>
    Metatable değeri raw metafield lookup ile incelenen value.
  </ParamField>

  <ParamField path={"metamethod"} type={"string"} required>
    raw metafield lookup içine verilen Metafield name.
  </ParamField>

  <ParamField path={"replacement"} type={"function"} required>
    Found metamethod function için replacement olarak hookfunction içine verilen Function.
  </ParamField>

  ## Dönüşler

  <ResponseField name={"original"} type={"function"}>
    hookfunction tarafından döndürülen cloned original metamethod closure.
  </ResponseField>

  ## Örnek

  Hook an existing metamethod function.

  ```lua theme={null}
  local object = setmetatable({}, {
      __index = function(_, key)
          return key
      end,
  })

  local original
  original = hookmetamethod(object, "__index", function(self, key)
      if key == "Name" then
          return "Real"
      end

      return original(self, key)
  end)
  ```
</div>
