[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: no __newindex support for userdata?
- From: Ando Sonenblick <ando@...>
- Date: Sun, 24 Aug 2003 13:02:09 -0700
I have a variable, say p, of type user data on which I need to eumulate
getting/setting of values as though the user data were a table:
p.x = 4 (catch this access to x and handle as appropriate)
q = p.x (catch this access and return the value of x)
I've sadly discovered that if my metatable for userdata p (heavy, not light)
has a __newindex method, it is NOT called when attempting to access x (and
Instead, lua complains that I cannot index userdata. Is there an "in lua"
way of intercepting the table-like access calls to userdata?
If not, I may need to patch lua itself and where it detects the error,
instead route it to get/set the variables as appropriate, etc...