lua-users home
lua-l archive

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



Doing remarkably, I think. It would take too long to go through what the 'enum' addition to LuaX really does, but it allows ..well.. what you'd expect from enums (type checking) and bitlib (binary or & and) sortof by itself.

Here's some code, testing SDL flags ('flags' is a userdata enum with 'call' metamethod):

	if gamestate.screen.flags(SDL_HWSURFACE) then
	--if btest( gamestate.screen.flags, SDL_HWSURFACE ) then
		print "Screen is in video memory"
	else
		print "Screen is in system memory"
	end

Or-ing values together is also simple:

	local event_buffer= SDL.Init( SDL_INIT_VIDEO.. SDL_INIT_AUDIO )


The features have been implemented with regular Lua 5.x userdata & metamethods. Might even work with Lua 4.0, haven't tested.. :)