As was said by others, your t
is a simple table, it contains only the following key-value pairs: [1]='four'
, [2]='five'
, [3]='six'
.
If you want to "extend" the t
to be able to access functions from the table
module, you have to set a metatable with __index
pointing to the table
module. I use the following function to access it easily:
function T(t)
return setmetatable(t, {__index = table})
end
You can then use it as follows (thanks to syntax sugar no parentheses needed):
t = T{'four', 'five', 'six'}
t:insert('seven')
print(t:contains('seven')) --> true
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…