[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: __write method?
- From: Steve Heller <steve@...>
- Date: Tue, 28 Aug 2007 14:58:16 -0700 (PDT)
--- Mark Hamburg <email@example.com> wrote (on Fri,
05 Sep 2003):
"For some structures, it is really useful to have a
write metamethod that is
always called rather than only being called when the
index isn't present.
Userdata already provides this, but tables don't. So,
I set out to implement
one for tables. My intended semantics were that if a
table had a __write
metamethod, this would be called for any non-raw set
operations performed on
I would change userdata to do the same thing, but that
would break existing
semantics if I replaced __newindex with __write and
adds extra overhead if I
test for both."
I need something very much like this. Would your
implementation work in Lua 5.1? If not, would you be
able to provide a version that would? I'm not
conversant with the Lua C code, or I'd do it myself.