#include "daemon/bindings.h"
/** @internal Compatibility wrapper for Lua 5.0 - 5.2 */
-#if LUA_VERSION_NUM < 502
+#if LUA_VERSION_NUM >= 502
+#define register_lib(L, name, lib) \
+ luaL_newlib((L), (lib))
+#else
#define lua_rawlen(L, obj) \
lua_objlen((L), (obj))
#define register_lib(L, name, lib) \
luaL_openlib((L), (name), (lib), 0)
-#else
-#define register_lib(L, name, lib) \
- luaL_newlib((L), (lib))
#endif
/** List loaded modules */
void engine_lualib(struct engine *engine, const char *name, lua_CFunction lib_cb)
{
if (engine != NULL) {
-#if LUA_VERSION_NUM < 502
- lib_cb(engine->L);
-#else
+#if LUA_VERSION_NUM >= 502
luaL_requiref(engine->L, name, lib_cb, 1);
lua_pop(engine->L, 1);
+#else
+ lib_cb(engine->L);
#endif
}
}