[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Why no pairs() for userdata, __len for tables?
- From: Rici Lake <lua@...>
- Date: Thu, 19 Apr 2007 15:24:01 -0500
Sam Roberts wrote:
On Thu, Apr 19, 2007 at 11:53:15AM -0700, Mark Hamburg wrote:
Except that you can't get to userdata metatables from pure Lua. But one
could certainly replace pairs with a C function that did this and you don't
need to patch the Lua sources to do it.
Maybe I misunderstand "get to", but it appears that I can access
userdata from the io library. Is this a version thing?
You can get the metatable of a userdata if it hasn't been locked
with a __metatable key. Many of us routinely set this key, though,
in order to protect the metatable