index a786077cd318bf4a7899f6b8414fa26e58ef9b6e..690ba29b740634f725852ae40ca35c5f7fbed745 100644 (file)
#include "lualib.h"
#include "../../src/rrd_tool.h"
+#ifdef LUA50
+#ifdef HAVE_COMPAT51
+#include "compat-5.1.h"
+#else
+#include "compat-5.1r5/compat-5.1.h"
+#endif
+#endif
+
extern void rrd_freemem(void *mem);
extern int luaopen_rrd (lua_State * L);
for (i=1; i<argc; i++) {
/* accepts string or number */
if (lua_isstring(L, i) || lua_isnumber(L, i)) {
- if (!(argv[i] = strdup(lua_tostring (L, i)))) {
+ if (!(argv[i] = lua_tostring (L, i))) {
/* raise an error and never return */
luaL_error(L, "%s - error duplicating string area for arg #%d",
cmd, i);
return 3;
}
+static int
+lua_rrd_flushcached(lua_State *L)
+{
+ return rrd_common_call(L, "flushcached", rrd_flushcached);
+}
+
#if defined(DINF)
static int
lua_rrd_info (lua_State * L)
{"restore", lua_rrd_restore},
{"tune", lua_rrd_tune},
{"update", lua_rrd_update},
+ {"flushcached", lua_rrd_flushcached},
#if defined(DINF)
{"info", lua_rrd_info},
{"updatev", lua_rrd_updatev},
int
luaopen_rrd (lua_State * L)
{
+#if defined LUA50
+ /* luaL_module is defined in compat-5.1.c */
+ luaL_module (L, "rrd", rrd, 0);
+#else
luaL_register (L, "rrd", rrd);
+#endif
set_info (L);
return 1;
}