lua-users home
lua-l archive

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


> In Lua beta5 there is no longer a settable metamethod, so you have
to work
> around that. The __newindex metamethod only applies to keys which
are not
> in the table. One simple workaround is:
> 
> do
>   local meta, getters, setters = {}, {}, {}
[...]

I don't think so.According to the manual the __newindex metamethod is
the settable event.I tried setting the same var twice(i=2;i=3;) and my
metamethod got called twice.
But besides that how can I make lua and C globals coexist?Is there
anyway to use my metamethod for userdata but the default action for
everything else?The only thing I can think of is to somehow call the
default method from within mine if the variable is not a C var.Is
there a way to do that?Or will I have to reimplement the defaults
myself inside my metamethod?