Sets the metatable for a table


See also Lua library functions.

Signature:

t = setmetatable(t, metatable)

Arguments:

  • t - A table (table)
  • metatable - A metatable for the table t, or nil to remove an existing metatable (table)

Returns:

  • t - The input table t (table)
This function is defined in the Lua standard libraries