lua-users home
lua-l archive

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

Yes, something on those lines.. I'll experiment with your code later. Cheers! :)


Shannon Stewman kirjoitti 25.12.2005 kello 9.16:

On Sat, Dec 24, 2005 at 09:35:17PM +0200, wrote:
The only thing I'd really want of Lua itself, is enumerated types, so that C API constants can be used as type-aware parameters, and catch any "false" usage (color enum where font enums should be, and such). This is a major issue for coding larger programs with SDL, Gtk+ etc. and currently, just placing those enums as integers is a Lowsy Solution. I shall look into this, if it could be achieved by the extended metatable handling there now is, or some other "stock
Lua" technique.

I've found a very easy way to do this in Lua 5.0 with light userdata.
The following example, not fully tested, is similar to the code I use in
my research: