From e5abd481cddd177055561bdf1ab840c5f54be567 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Sat, 6 Jun 2009 17:42:02 -0600 Subject: [PATCH] Fix some stupidity in 33754ecebe33eb0b5f517012da59757a3207cb52. --- src/conky.c | 6 +++--- src/llua.c | 4 ++-- src/llua.h | 9 ++++++++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/conky.c b/src/conky.c index 23621cbe..d48a2b90 100644 --- a/src/conky.c +++ b/src/conky.c @@ -4514,7 +4514,7 @@ static void generate_text_internal(char *p, int p_max_size, free(tmp_info); } OBJ(lua_bar) { - int per; + double per; if (llua_getnumber(obj->data.s, &per)) { #ifdef X11 if(output_methods & TO_X) { @@ -4530,14 +4530,14 @@ static void generate_text_internal(char *p, int p_max_size, } #ifdef X11 OBJ(lua_graph) { - int per; + double per; if (llua_getnumber(obj->data.s, &per)) { new_graph(p, obj->a, obj->b, obj->c, obj->d, per, obj->e, 1, obj->char_a, obj->char_b); } } OBJ(lua_gauge) { - int per; + double per; if (llua_getnumber(obj->data.s, &per)) { new_gauge(p, obj->a, obj->b, (per/100.0 * 255)); } diff --git a/src/llua.c b/src/llua.c index 56aa9539..10f0c845 100644 --- a/src/llua.c +++ b/src/llua.c @@ -165,7 +165,7 @@ char *llua_getstring_read(const char *function, const char *arg) return ret; } -double llua_getnumber(const char *args, int *per) +int llua_getnumber(const char *args, double *ret) { char *func; @@ -176,7 +176,7 @@ double llua_getnumber(const char *args, int *per) if(!lua_isnumber(lua_L, -1)) { ERR("llua_getnumber: function %s didn't return a number, result discarded", func); } else { - *per = lua_tonumber(lua_L, -1); + *ret = lua_tonumber(lua_L, -1); lua_pop(lua_L, 1); return 1; } diff --git a/src/llua.h b/src/llua.h index 80179f53..c520dc60 100644 --- a/src/llua.h +++ b/src/llua.h @@ -26,13 +26,20 @@ #include #include +/* initialize lua stuff */ void llua_init(void); +/* load a lua script */ void llua_load(const char *script); +/* call a function with args, and return a string from it (must be free'd) */ char *llua_getstring(const char *args); +/* call a function with args, and return a string from it (must be free'd) */ char *llua_getstring_read(const char *function, const char *arg); -double llua_getnumber(const char *args, int *per); +/* call a function with args, and put the result in ret */ +int llua_getnumber(const char *args, double *ret); +/* close lua stuff */ void llua_close(void); #ifdef HAVE_SYS_INOTIFY_H +/* check our lua inotify status */ void llua_inotify_query(int wd, int mask); #endif /* HAVE_SYS_INOTIFY_H */