[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: __type for better typing
- From: askok@...
- Date: Wed, 27 Sep 2006 15:01:58 +0300
I second something like this would be useful.
My enum approach uses a __typeof() function within the
metatable, which can be a constant string, too. A well
thought out system could be useful for tables, userdata
and enums all of them.
Basically, I'd see this as a "subtype", and make type()
return two values, instead of the one it now returns.
This way, compatibility hick-ups could be smaller, too?
On Wed, 27 Sep 2006 12:27:33 +0200
Timm Felden <firstname.lastname@example.org> wrote:
Is there any *good* way to get the type of a table or
userdata. I'm thinking of types like "Vector" or "Sprite"
or something else, that I am using internally. Currently
I'm using typechecking with the REGISTRYINDEX but I it
doesn't work with my new OOP System.
So I came up with the idea to add an __type field to the
metatable but this would mean to me, that I have to
implement a new gettype function. Maybe someone has a