6 #include <rpm/rpmlib.h>
8 #define _RPMLUA_INTERNAL
9 #include "rpmio/rpmlua.h"
10 #include "lib/rpmliblua.h"
12 static int rpm_vercmp(lua_State *L)
17 v1 = luaL_checkstring(L, 1);
18 v2 = luaL_checkstring(L, 2);
20 lua_pushinteger(L, rpmvercmp(v1, v2));
26 static const luaL_Reg luarpmlib_f[] = {
27 {"vercmp", rpm_vercmp},
31 #ifndef lua_pushglobaltable
32 #define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
37 rpmlua lua = rpmluaGetGlobalState();
38 lua_pushglobaltable(lua->L);
39 #if (LUA_VERSION_NUM < 502) || defined(LUA_COMPAT_MODULE)
40 luaL_register(lua->L, "rpm", luarpmlib_f);
42 luaL_pushmodule(lua->L, "rpm", 1);
43 lua_insert(lua->L, -1);
44 luaL_setfuncs(lua->L, luarpmlib_f, 0);
51 rpmlua lua = rpmluaGetGlobalState();