Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What is a metatable?

Can someone break it down for me? The wiki is confusing for me and I don't understand it's purpose and what it does. Can anyone help? Thank you!

2 answers

✓ Accepted answer

Go here, I found it very useful for better understanding metatables.

1 comment

0

Could be a comment..

To explain metatables to a beginner, I would say it's a table within a table that manages the table.

local t = {"pizza", "pie"}
local mt = {__index = function(t, i, v)
	return "ice"
end}
setmetatable(t, mt)

Basically what this code will return "ice" if you try to index a nil value inside table "t".

This discussion is preserved as it was. New answers, comments, and votes are closed.