aboutsummaryrefslogtreecommitdiffstats
path: root/util-src
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-09-15 01:17:53 +0200
committerKim Alvefur <zash@zash.se>2018-09-15 01:17:53 +0200
commit110ce660d58c6c7bc07b83da513aa0ef30400ec7 (patch)
treef82ed19b005ad3af5c01e37ac1e7b638c7c70842 /util-src
parent1ad376770fced834956528b83c20ab2fdfe3e62c (diff)
downloadprosody-110ce660d58c6c7bc07b83da513aa0ef30400ec7.tar.gz
prosody-110ce660d58c6c7bc07b83da513aa0ef30400ec7.zip
util.poll: Lua 5.1 compat
Diffstat (limited to 'util-src')
-rw-r--r--util-src/poll.c6
1 files changed, 6 insertions, 0 deletions
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);
{