diff --git a/src/lua-hiredis.c b/src/lua-hiredis.c
index 4a465ce..8c9541b 100644
--- a/src/lua-hiredis.c
+++ b/src/lua-hiredis.c
@@ -50,6 +50,10 @@ static void luaL_register(lua_State * L, const char * name, const luaL_Reg * l)
 }
 #endif
 
+#ifndef luaL_checkint
+#define luaL_checkint(L, n) ((int)luaL_checkinteger(L,n))
+#endif
+
 typedef struct luahiredis_Enum
 {
   const char * name;
