util.poll: Lua 5.1 compat
authorKim Alvefur <zash@zash.se>
Sat, 15 Sep 2018 01:17:53 +0200
changeset 9321 3429006518bf
parent 9320 d8496858c809
child 9322 7c954c75b6ac
util.poll: Lua 5.1 compat
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);
 	{