lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> You can implement an 'oldindex' metamethod (and more) by using a proxy
table.

I feel we've been round this loop before, but the proxy table work-round
means creating two new tables for every one required and processing the
'newindex' metamethod for every table write. With 'oldindex', for non-nil
writes you can proceed immediately to the write without calling the
metamethod. For nil writes you do need to first read the current value, but
if the value is already nil, you can avoid the metamethod call and the
write. For the case of reading the current value, calling the metamethod and
then writing nil, it should be possible to cache an address to avoid
dereferencing the same index twice.


Attachment: smime.p7s
Description: S/MIME cryptographic signature