lua-users home
lua-l archive

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


Well, I couldn't find a signal library for Lua so I wrote one up. You
can download it here (for now):

http://www.unm.edu/~batrick/lua_signal/files/

batrick@waterdeep:~/lua/signal$ lua -lsignal
Lua 5.1.2  Copyright (C) 1994-2007 Lua.org, PUC-Rio
> signal.signal("SIGTERM", function() print"dying..." os.exit(1) end)
> signal.raise("SIGTERM")
dying...
batrick@waterdeep:~/lua/signal$

I didn't make a make file because to be honest I haven't learned how yet :P

It compiles cleanly on ubuntu with:

gcc -shared -o signal.so lsignal.c

so I imagine there shouldn't be any trouble. It's clean ANSI C for now
although I want to add some POSIX signals and kill() later. For those
that try SIGINT, keep in mind the Lua interpetter resets that every
time it executes a line or file.

Comments, concerns, and criticisms welcome :)

Cheers,

-- 
-Patrick Donnelly

"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."

-Will Durant