lua-users home
lua-l archive

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



I will surely be patching it in myself, if only to see whether lhf is right. :)

More often than not, the Lua authors have in fact been the "wize old guys" knowing better, in the end. But I do persist, that having type- aware enums is simply a killer feature for some bindings, such as SDL and maybe the kinds like Gtk+.

The only difference of not having this ability, shall be different behaviour of type() whether a module is loaded via stock Lua, or LuaX (or stock Lua, and LuaX module). :) Gosh, I don't really know, where this road takes me, but it will be fun!

-asko


Lisa Parratt kirjoitti 17.1.2006 kello 12.18:

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

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.

--
Lisa
http://www.thecommune.org.uk/~lisa/