lua-users home
lua-l archive

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

Luiz Henrique de Figueiredo wrote:
I meant, all programs that do this or something equivalent:
	if type(x)=="userdata" then ...


One would imagine that if someone overrode the result of type, then they'd *want* that to fail.

Asko: As with most limitations on metamethods, I'd advise patching it in yourself. I've had to do this because I wanted to do real metaprogramming, and after a few tweaks, it works great. I've made objects that appear to be true numbers to any Lua code, but are in fact tables containing proxy objects. I've not profiled things, but I think it's only slightly slower than stock Lua. It's an easy price to pay for flexibility, though.