[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: When does __index metamethod get called?
- From: Chris <coderight@...>
- Date: Thu, 16 Mar 2006 18:20:16 -0500
Example:
tbl = {}
setmetatable(tbl, {__index = function(t,k) print("test") end})
tbl[1] = 1
tbl[2] = 2
Prints nothing... ??
Also, is there any metamethod that you can hook to know when a value is
being set? I know there is __newindex but that only appears to be
called for new values being inserted into the table. I want to
hook both cases of new values and also setting existing values.
--
// Chris