From 110ce660d58c6c7bc07b83da513aa0ef30400ec7 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 15 Sep 2018 01:17:53 +0200 Subject: util.poll: Lua 5.1 compat --- util-src/poll.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util-src/poll.c b/util-src/poll.c index e80850d2..c0a93b04 100644 --- a/util-src/poll.c +++ b/util-src/poll.c @@ -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 @@ int Lnew(lua_State *L) { * Open library */ int luaopen_util_poll(lua_State *L) { +#if (LUA_VERSION_NUM > 501) luaL_checkversion(L); +#endif luaL_newmetatable(L, STATE_MT); { -- cgit v1.2.3