Exemple #1
0
/**
 * Create the child metatable in the registry.
 *
 * [-0, +1, ?]
 */
static int create_child_mt(lua_State *L) {
    static luaL_reg methods[] = {
        { "stop",          child_stop },
        { "start",         child_start },
        { "getpid" ,       child_getpid },
        { "getrpid" ,      child_getrpid },
        { "getstatus" ,    child_getstatus },
        { NULL, NULL }
    };
    return add_watcher_mt(L, methods, CHILD_MT);
}
Exemple #2
0
/**
 * Create the idle metatable in the registry.
 *
 * [-0, +1, ?]
 */
static int create_idle_mt(lua_State *L) {

    static luaL_Reg fns[] = {
        { "stop",          idle_stop },
        { "start",         idle_start },
        { NULL, NULL }
    };
    luaL_newmetatable(L, IDLE_MT);
    add_watcher_mt(L);
    luaL_setfuncs(L, fns, 0);

    return 1;
}
Exemple #3
0
/**
 * Create the io metatable in the registry.
 *
 * [-0, +1, ?]
 */
static int create_io_mt(lua_State *L) {

    static luaL_reg fns[] = {
        { "stop",          io_stop },
        { "start",         io_start },
        { "getfd" ,        io_getfd },
        { NULL, NULL }
    };
    luaL_newmetatable(L, IO_MT);
    add_watcher_mt(L);
    luaL_register(L, NULL, fns);

    return 1;
}
Exemple #4
0
/**
 * Create the timer metatable in the registry.
 *
 * [-0, +1, ?]
 */
static int create_timer_mt(lua_State *L) {

    static luaL_Reg fns[] = {
        { "again",         timer_again },
        { "stop",          timer_stop },
        { "start",         timer_start },
        { "clear_pending", timer_clear_pending },
        { NULL, NULL }
    };
    luaL_newmetatable(L, TIMER_MT);
    add_watcher_mt(L);
    luaL_setfuncs(L, fns, 0);

    return 1;
}