[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: luax & bit operations
- From: Asko Kauppi <asko.kauppi@...>
- Date: Tue, 14 Dec 2004 02:14:46 +0200
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
if gamestate.screen.flags(SDL_HWSURFACE) then
--if btest( gamestate.screen.flags, SDL_HWSURFACE ) then
print "Screen is in video memory"
print "Screen is in system memory"
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.. :)