[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: __index : vs . Discrimination?
- From: Ando Sonenblick <ando@...>
- Date: Sun, 24 Aug 2003 12:47:16 -0700
Gang, consider this:
"p = {}
t = {
__index = function(table, key) print("index") end
}
setmetatable(p, t)"
Now, when I execute these two following lines of lua code:
"q = p.x
p:fn()"
...both end up going through __index in an attempt to look up x and fn in p,
respectively.
I've been trying everything, but haven't figured out a way (if it's possible
at all) to distinguish inside my __index function whether it is being called
via a . (dot) operator or a : (colon) operator.
Is this possible?
Thx,
Ando