Commit 1b5c5320 authored by Marek Vavruša's avatar Marek Vavruša

daemon: unified Lua version checks

parent 119359d1
......@@ -20,14 +20,14 @@
#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 */
......
......@@ -321,11 +321,11 @@ int engine_unregister(struct engine *engine, const char *name)
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
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment