|
Matias Guijarro wrote:
Lua 5.1 Copyright (C) 1994-2006 Lua.org, PUC-Rio > setmetatable({}, { __tostring = function (t) print("hello") end }) > print({}) table: 0x8091e30
AFAIK one can't set metatable to table type, only to individual tables: local t1 = {} setmetatable(t1, { __tostring = function (t) return "hello" end }) print(t1) -- Shmuel