# HG changeset patch # User Kim Alvefur # Date 1536967073 -7200 # Node ID 3429006518bf66164152f5b905dfa5cda9ef2f52 # Parent d8496858c809bdfd13cf6906ae65ea004bbd23fa util.poll: Lua 5.1 compat diff -r d8496858c809 -r 3429006518bf util-src/poll.c --- a/util-src/poll.c Sat Sep 15 01:05:59 2018 +0200 +++ b/util-src/poll.c Sat Sep 15 01:17:53 2018 +0200 @@ -34,6 +34,10 @@ #define STATE_MT "util.poll.select" #endif +#if (LUA_VERSION_NUM == 501) +#define luaL_setmetatable(L, tname) luaL_getmetatable(L, tname); lua_setmetatable(L, -2) +#endif + /* * Structure to keep state for each type of API */ @@ -380,7 +384,9 @@ * Open library */ int luaopen_util_poll(lua_State *L) { +#if (LUA_VERSION_NUM > 501) luaL_checkversion(L); +#endif luaL_newmetatable(L, STATE_MT); {