Do metatables work on tables? I was thinking something like:
local tab = {} local metaTab = { __index = function(tab, i) print(tab, i) end) } function tab:test(what) print(what) end setmetatable(tab, metaTab) tab:test("wat")
Yes. In Lua 5.2+, that's the only thing metatables work with. In Lua 5.1 (what Roblox uses), metatables can be used with userdatas and tables.