int luaopen_thread(lua_State *L) { aux_open(L); aux_newclass(L, "mutex", mutex_ops); aux_newclass(L, "cond", cond_ops); luaL_module(L, "thread", lib_ops, 0); lua_pushstring(L, "VERSION"); lua_pushstring(L, LUATHREAD_VERSION); lua_settable(L, -3); return 1; }
/*-------------------------------------------------------------------------*\ * Initializes module \*-------------------------------------------------------------------------*/ int udp_open(lua_State *L) { /* create classes */ aux_newclass(L, "udp{connected}", udp); aux_newclass(L, "udp{unconnected}", udp); /* create class groups */ aux_add2group(L, "udp{connected}", "udp{any}"); aux_add2group(L, "udp{unconnected}", "udp{any}"); aux_add2group(L, "udp{connected}", "select{able}"); aux_add2group(L, "udp{unconnected}", "select{able}"); /* define library functions */ luaL_openlib(L, NULL, func, 0); return 0; }