There is no such metamethod, table.insert simply inserts a new value into the specified table.
local myTable = {} table.insert(myTable, "somestring") -- so now myTable has one value, myTable = { "somestring" }
It works like:
local myTable = {} myTable[
__ newindex metamethod only affects the assignment operator "=", table.insert is just a separate function, not related to meta tags, you can change the behavior of this function if you want:
_tableinsert = table.insert function table.insert(t, v) -- here your actions, before real function will be used _tableinsert(t, v) end
I think it would be possible to create your own __tableinsert metamethod this way.
source share