[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: table.new in 5.3?
- From: Andrew Starks <andrew.starks@...>
- Date: Wed, 20 Nov 2013 16:24:37 -0600
On Wed, Nov 20, 2013 at 4:14 PM, Steven Johnson
<steve@xibalbastudios.com> wrote:
>> While we are on the subject of API functions that would be nice to
>> have directly from Lua:
>>
>> 1. getmetafield(tbl,key) -- calls luaL_getmetafield.
>
> Some time in the ancient past I seconded this same suggestion. The
> thinking being that a __metatable key meant you couldn't ask what
> metamethods something implemented, whereas the intent was probably
> just to make that thing tamper-proof. This was obviously simple to add
> when I controlled the environment, but otherwise it's not quite
> possible to make correct versions of is_callable() et al. without
> recourse to debug.metatable().
>
What do you think about something like `getudtype(userdatavalue)`,
where the field name from the registry or something like a __type
field value would be returned.
Again, easy to add if you've got debug. I find that as a Lua user,
knowing the *kind* of userdata that I'm holding is sometimes relevant.