lua-users home
lua-l archive

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


Roberto wrote:
> To say that the backward compatibility is "suspect" is a bit strong, but
> I have some questions about it (questions, not suspicions ;-) Could you
> explain how would you achieve this compatibility? (Remember that, although
> the global events are a subset of the table events, they are not selected
> in the same way. You have only one pair of settable/gettable handlers for
> a given global table, but you may have different setglobal/getglobal
> handlers for different global values.)

I've attached the backward compatibility tag methods (mostly just copied
from the Lua manual) along with a simple test.

I don't quite understand the issue you mentioned.  If you can think of some
reasonable code where the compatibility would fail please show it to me.

For the compatibility, get/settagmethod should handle registering and
retrieval of get/setglobal events just as they do now (although those events
should be deprecated).  It's just that accessing the global scope will not
trigger them, and instead will trigger the table events (settable, gettable,
index).

-John

Attachment: global-tm-emu.lua
Description: Binary data