1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-27 04:32:55 +00:00

Fix some stupidity in 33754ecebe.

This commit is contained in:
Brenden Matthews 2009-06-06 17:42:02 -06:00
parent 33754ecebe
commit e5abd481cd
3 changed files with 13 additions and 6 deletions

View File

@ -4514,7 +4514,7 @@ static void generate_text_internal(char *p, int p_max_size,
free(tmp_info); free(tmp_info);
} }
OBJ(lua_bar) { OBJ(lua_bar) {
int per; double per;
if (llua_getnumber(obj->data.s, &per)) { if (llua_getnumber(obj->data.s, &per)) {
#ifdef X11 #ifdef X11
if(output_methods & TO_X) { if(output_methods & TO_X) {
@ -4530,14 +4530,14 @@ static void generate_text_internal(char *p, int p_max_size,
} }
#ifdef X11 #ifdef X11
OBJ(lua_graph) { OBJ(lua_graph) {
int per; double per;
if (llua_getnumber(obj->data.s, &per)) { if (llua_getnumber(obj->data.s, &per)) {
new_graph(p, obj->a, obj->b, obj->c, obj->d, new_graph(p, obj->a, obj->b, obj->c, obj->d,
per, obj->e, 1, obj->char_a, obj->char_b); per, obj->e, 1, obj->char_a, obj->char_b);
} }
} }
OBJ(lua_gauge) { OBJ(lua_gauge) {
int per; double per;
if (llua_getnumber(obj->data.s, &per)) { if (llua_getnumber(obj->data.s, &per)) {
new_gauge(p, obj->a, obj->b, (per/100.0 * 255)); new_gauge(p, obj->a, obj->b, (per/100.0 * 255));
} }

View File

@ -165,7 +165,7 @@ char *llua_getstring_read(const char *function, const char *arg)
return ret; return ret;
} }
double llua_getnumber(const char *args, int *per) int llua_getnumber(const char *args, double *ret)
{ {
char *func; char *func;
@ -176,7 +176,7 @@ double llua_getnumber(const char *args, int *per)
if(!lua_isnumber(lua_L, -1)) { if(!lua_isnumber(lua_L, -1)) {
ERR("llua_getnumber: function %s didn't return a number, result discarded", func); ERR("llua_getnumber: function %s didn't return a number, result discarded", func);
} else { } else {
*per = lua_tonumber(lua_L, -1); *ret = lua_tonumber(lua_L, -1);
lua_pop(lua_L, 1); lua_pop(lua_L, 1);
return 1; return 1;
} }

View File

@ -26,13 +26,20 @@
#include <lauxlib.h> #include <lauxlib.h>
#include <lualib.h> #include <lualib.h>
/* initialize lua stuff */
void llua_init(void); void llua_init(void);
/* load a lua script */
void llua_load(const char *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); 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); 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); void llua_close(void);
#ifdef HAVE_SYS_INOTIFY_H #ifdef HAVE_SYS_INOTIFY_H
/* check our lua inotify status */
void llua_inotify_query(int wd, int mask); void llua_inotify_query(int wd, int mask);
#endif /* HAVE_SYS_INOTIFY_H */ #endif /* HAVE_SYS_INOTIFY_H */