diff --git a/daemon/bindings.c b/daemon/bindings.c
index 49a6503ebfd26783752b413067bcbb992474cd5d..66c54cb84f28656180c771878f24492a0edf455a 100644
--- a/daemon/bindings.c
+++ b/daemon/bindings.c
@@ -21,6 +21,7 @@
 
 /** @internal Compatibility wrapper for Lua 5.0 - 5.2 */
 #if LUA_VERSION_NUM < 502
+#define lua_len lua_objlen
 #define register_lib(L, name, lib) \
 	luaL_openlib((L), (name), (lib), 0)
 #else