lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Roberto Ierusalimschy a écrit :
>> Er why? Surely the straightforward code is better in every respect?
>>
>> [...]
>> +  int t1 = ttype(p1);
>> +  int t2 = ttype(p2);
>> +  if (t1 == t2)
>> +    luaG_runerror(L, "attempt to compare two %s values", luaT_typenames[t1]);
>> [...]
> 
> Light userdata and full userdata are different types but have the same name.
> 
> -- Roberto
> 

	Ok, I have a uglier dirty hack in mind! Why not casting the two first
char of the typename into a short. You get a unique number representing
each type without having to use string comparison. ;)

	Thomas.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktLiywACgkQBV7eXqefhqiNtQCff4XKgmMhZrX66XbB1ZGa4b6H
2y0Ani8k1ynZ9+Yl0HY2eh98ONJLeZkm
=3Ot1
-----END PGP SIGNATURE-----