[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Weak Type: A type library for the weak (hack stage)
- From: Philipp Janda <siffiejoe@...>
- Date: Mon, 12 Aug 2013 17:57:53 +0200
Am 12.08.2013 16:43 schröbte Andrew Starks:
On Sat, Aug 10, 2013 at 6:16 AM, John Hind <firstname.lastname@example.org> wrote:
I like this a lot.
One possible extension is to follow the lead of luaL_checkudata surfacing
this test in Lua. So if a type is defined using a userdata with a metatable
stored under a type name in the registry (as the C API encourages):
checks if type is a userdata or table with a metatable equal to the table
stored in the registry under the key "mytype".
This allows for the test to work even if a "type" metavalue is not defined.
I love your idea. It's actually the problem that I set out to solve,
before I learned I would need the C-API to solve it.
No need for the C API if you have the debug module available:
> print( debug.getregistry()["FILE*"], debug.getmetatable( io.stdin ) )
table: 0x7446d0 table: 0x7446d0