According to the wiki, the metamethod “__index” fires when an index in a table is read from if the value for that index is nil.
I don’t quite understand what “table” they mean. For example:
local mt = {"ya"}
mt.__index = mt
local t = {}
setmetatable(t,mt)
print(t[1])
According to their explanation, the “table” is “t”, correct? If that’s true, i’m guessing that “mt” being a metatable of “t” has something to do with mt’s metamethod __index being fired when t[1] is tried (t[1] is nil).
Think of a metatable as a table of events that occur when certain operations happen in relation to a table.
You can actually make a single table both a metatable and table. But in that instance yes mt is the table where you can intervene in operations that occur with table t.