lua-users home
lua-l archive

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


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

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

--
Fabio Mascarenhas


On Thu, Sep 4, 2008 at 12:55 AM, Fabio Mascarenhas <mascarenhas@acm.org> wrote:
> Hi,
>
> For some reason the tarball on LuaForge was different from the version
> in the repo (this is not supposed to happen as I have a make target
> that packages and uploads the repo, but alas...), so this small bug
> got away. It's fine now, so another "luarocks install alien" and the
> example will run without glitches (apart from Ubuntu calling the
> blasted lib libSDL-1.2.so instead of libSDL.so.1.2).
>
> Joshua, could you explain what you use the type "cfunction" for? Maybe
> I can overload one of the current types (pointer or callback) to do
> what it does, instead of adding yet another one... and what about the
> changes to struct (the "I" format and the extra parameter to userdata
> unpacking)?
>
> 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.
>
> --
> Fabio Mascarenhas
>