Changeset

9318:3429006518bf

util.poll: Lua 5.1 compat
author Kim Alvefur <zash@zash.se>
date Sat, 15 Sep 2018 01:17:53 +0200
parents 9317:d8496858c809
children 9319:7c954c75b6ac
files util-src/poll.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);
 	{