Volt

Metatable

The Metatable library provides functions for working with metatables and metamethods on Roblox objects.

Overview

These functions allow you to:

  • Access raw metatables on locked objects
  • Modify metatable read-only status
  • Get the namecall method in hooks

Available Functions

FunctionDescription
getnamecallmethodGet the method name in a namecall hook
getrawmetatableGet the raw metatable of an object
isreadonlyCheck if a table is read-only
iswritableCheck if a table is writable
makereadonlyMake a table read-only
makewritableMake a table writable
setnamecallmethodSet the method name in a namecall hook
setrawmetatableSet the raw metatable of an object
setreadonlySet a table's read-only status

Understanding Metatables

Metatables in Lua control the behavior of tables and userdata. They define how objects respond to operations like indexing, calling, and arithmetic.

Common Metamethods

MetamethodTriggered By
__indexReading a missing key (obj.key)
__newindexWriting to a key (obj.key = value)
__namecallMethod calls (obj:method())
__callCalling as function (obj())
__tostringString conversion (tostring(obj))

On this page