[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua hacking wondering
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 22 Jun 2004 17:00:20 -0300
> > This is the impression I'm under as well, but I was wondering:
> > since these entries in the metatable (the metamethods that is)
> > are used by the VM it wouldn't be too ugly to keep a number of
> > flags with each table/userdata for storing wich (of the "standard")
> > metamethods have been set in it's metatable. Then every time, say,
> > an index operation takes place all you have to do is check if the
> > index flag is set (a very cheap operation) instead of looking up
> > the metatable and indexing it.
> Actually I think this is roughly how it's implemented in reality.
The metatable itself has these bits. When we modify a table there
is no way to know which objects use it as a metatable, so there would
be no way to reset their bits.
-- Roberto