lua-users home
lua-l archive

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


I liked Michal Kolodziejczyk demonstration of using SDL library with
alien module so I have changed and extend it a little and here is my
creation attached.

One thing that bother me is that I can not find why game always end
with segmentation fault when I am closing it! What is strange it
segfault after last command in the game is executed. I strongly
suspect it has to do something with memory management but can not
figure out a cure. Any suggestion?

While working with alien there was several questions I could not
answer. When defining prototype how do I indicate unsigned integers
of all kind:
SDL.SDL_FillRect:types("int", "pointer", "pointer", "unsigned int")

Also while trying struct.unpack I missed a possibility to unpack
pointer as light userdata, I resolved this with buff:get(5, "pointer").

And lastly when I allocate a buffer with alien.buffer() how do I free
it?  I guess this can be reason why my program ends with segmentation
fault, because I allocate buffers on several places but never free any
of them. Or does garbage collector take care of them?

Martin

Attachment: plain_pong.tar.bz2
Description: Binary data