Comparison

util-src/signal.c @ 6418:ae798314347c

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Thu, 18 Sep 2014 02:22:48 +0200
parent 6413:a552f4170aed
child 6615:8e4572a642cb
comparison
equal deleted inserted replaced
6410:d782cbb46c2a 6418:ae798314347c
29 #include <signal.h> 29 #include <signal.h>
30 #include <stdlib.h> 30 #include <stdlib.h>
31 31
32 #include "lua.h" 32 #include "lua.h"
33 #include "lauxlib.h" 33 #include "lauxlib.h"
34
35 #if (LUA_VERSION_NUM == 502)
36 #define luaL_register(L, N, R) luaL_setfuncs(L, R, 0)
37 #endif
34 38
35 #ifndef lsig 39 #ifndef lsig
36 40
37 #define lsig 41 #define lsig
38 42
382 int luaopen_util_signal(lua_State *L) 386 int luaopen_util_signal(lua_State *L)
383 { 387 {
384 int i = 0; 388 int i = 0;
385 389
386 /* add the library */ 390 /* add the library */
387 luaL_register(L, "signal", lsignal_lib); 391 lua_newtable(L);
392 luaL_register(L, NULL, lsignal_lib);
388 393
389 /* push lua_signals table into the registry */ 394 /* push lua_signals table into the registry */
390 /* put the signals inside the library table too, 395 /* put the signals inside the library table too,
391 * they are only a reference */ 396 * they are only a reference */
392 lua_pushstring(L, LUA_SIGNAL); 397 lua_pushstring(L, LUA_SIGNAL);
393 lua_createtable(L, 0, 0); 398 lua_newtable(L);
394 399
395 while (lua_signals[i].name != NULL) 400 while (lua_signals[i].name != NULL)
396 { 401 {
397 /* registry table */ 402 /* registry table */
398 lua_pushstring(L, lua_signals[i].name); 403 lua_pushstring(L, lua_signals[i].name);