equal
deleted
inserted
replaced
42 #include <lualib.h> |
42 #include <lualib.h> |
43 #include <lauxlib.h> |
43 #include <lauxlib.h> |
44 |
44 |
45 #define STATE_MT "util.poll<" POLL_BACKEND ">" |
45 #define STATE_MT "util.poll<" POLL_BACKEND ">" |
46 |
46 |
47 #if (LUA_VERSION_NUM == 501) |
|
48 #define luaL_setmetatable(L, tname) luaL_getmetatable(L, tname); lua_setmetatable(L, -2) |
|
49 #endif |
|
50 #if (LUA_VERSION_NUM < 504) |
47 #if (LUA_VERSION_NUM < 504) |
51 #define luaL_pushfail lua_pushnil |
48 #define luaL_pushfail lua_pushnil |
52 #endif |
49 #endif |
53 |
50 |
54 /* |
51 /* |
562 |
559 |
563 /* |
560 /* |
564 * Open library |
561 * Open library |
565 */ |
562 */ |
566 int luaopen_util_poll(lua_State *L) { |
563 int luaopen_util_poll(lua_State *L) { |
567 #if (LUA_VERSION_NUM > 501) |
|
568 luaL_checkversion(L); |
564 luaL_checkversion(L); |
569 #endif |
|
570 |
565 |
571 luaL_newmetatable(L, STATE_MT); |
566 luaL_newmetatable(L, STATE_MT); |
572 { |
567 { |
573 |
568 |
574 lua_pushliteral(L, STATE_MT); |
569 lua_pushliteral(L, STATE_MT); |