元表的作用 元表是用来定义对table或userdata操作方式的表 举个例子 local t1 = {1} local t2 = {2} local t3 = t1 + t2 我们直接对两个table执行+运算,会报错 lua: /usercode/file.lua:3: attempt to perform arithmetic on local 't1' (a table value) 因为程序不知道如何对两个表执行+运行,这时候就需要通过元表来定义如何执行t1的+运算,有点类似于c语言中…