Re: Feature Request: type() consult __type for userdata
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Feature Request: type() consult __type for userdata
- From: "Greg Fitzgerald" <garious@...>
- Date: 2008年1月18日 21:14:47 -0800
Hi Luiz,
>> Would there be any downside to Lua's 'type()' returning the value of a
>> '__type' metamethod if its type is 'userdata'?
>> return t == "userdata" and mt and mt.__type or t
> Yes, it'd break all programs that rely on type returning "userdata"...
How so? It would only break programs with userdata types that have a metamethod named "__type". All others would continue to return "userdata". Do many (any?) Lua programs make use of a __type metamethod?
Thanks,
Greg