lua-users home
lua-l archive

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


On Thu, Sep 04, 2008 at 01:04:11AM -0300, Fabio Mascarenhas wrote:
> 
> BTW, very nice work with the game! Pong never gets old. :-) Though a
> proper SDL api would use alien.wrap and wrapper functions to add some
> type safety. See aio.lua inside this tarball, for example:
> http://alien.luaforge.net/aio-current.tar.gz

I will check that out.

> Automatic generation of safe wrappers is one of the things in my todo
> list (it's doable with a smarter types method).

Or better yet, I will wait while you exhaust your todo list!
How lazy man can be? :)

BTW, I added two extra braces into core.c as Joshue indicated and
now I get segfault no more. I am a happy man now!

> > About signed vs unsigned, I wanted to see how far I could go without
> > adding this extra cruft (apart from the inevitable case of char vs
> > byte). In your SDL_FIllRect example, for example, you can use this as
> > prototype to SDL_MapRGBA:
> >
> > SDL.SDL_MapRGBA:types("int", "pointer", "char", "char", "char", "char")
> >
> > and then declare the last type of FillRect as int. It will all work
> > out in the end. It will even work if you build it in Lua "by hand"
> > (using bitlib) and then pass as a regular (signed) int.

And this is how I used it until I find out how to extract format
pointer from surface structure (RTFM), except intead of bitlib I used
ordinarily plus and multiply operators.

Is it possible to always use int intead of usinget int or can I
expect trouble with this?

Martin