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; }
void luaCompat_openlib(lua_State* L, const char* libname, const struct luaL_Reg* funcs) { /* lua5 */ LUASTACK_SET(L); #if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501 luaL_register(L, libname, funcs); #elif defined(COMPAT51) luaL_module(L, libname, funcs, 0); #else luaL_openlib(L, libname, funcs, 0); #endif LUASTACK_CLEAN(L, 1); }