1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-18 02:55:12 +00:00

convert lua_barval to double

This commit is contained in:
Phil Sutter 2009-12-04 01:34:11 +01:00
parent f1a57e40aa
commit 2fc1efa8d5
3 changed files with 6 additions and 6 deletions

View File

@ -1449,7 +1449,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
obj->callbacks.print = &print_lua_parse;
obj->callbacks.free = &gen_free_opaque;
END OBJ_ARG(lua_bar, 0, "lua_bar needs arguments: <height>,<width> <function name> [function parameters]")
arg = scan_bar(obj, arg, 255);
arg = scan_bar(obj, arg, 100);
if(arg) {
obj->data.s = strndup(arg, text_buffer_size);
} else {
@ -1460,7 +1460,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
#ifdef X11
END OBJ_ARG(lua_graph, 0, "lua_graph needs arguments: <function name> [height],[width] [gradient colour 1] [gradient colour 2] [scale] [-t] [-l]")
char *buf = 0;
buf = scan_graph(obj, arg, 255);
buf = scan_graph(obj, arg, 100);
if (buf) {
obj->data.s = buf;
} else {
@ -1470,7 +1470,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
obj->callbacks.free = &gen_free_opaque;
#endif /* X11 */
END OBJ_ARG(lua_gauge, 0, "lua_gauge needs arguments: <height>,<width> <function name> [function parameters]")
arg = scan_gauge(obj, arg, 255);
arg = scan_gauge(obj, arg, 100);
if (arg) {
obj->data.s = strndup(arg, text_buffer_size);
} else {

View File

@ -546,11 +546,11 @@ void print_lua_parse(struct text_object *obj, char *p, int p_max_size)
}
}
uint8_t lua_barval(struct text_object *obj)
double lua_barval(struct text_object *obj)
{
double per;
if (llua_getnumber(obj->data.s, &per)) {
return round_to_int(per * 2.55);
return per;
}
return 0;
}

View File

@ -67,6 +67,6 @@ void llua_update_info(struct information *i, double u_interval);
void print_lua(struct text_object *, char *, int);
void print_lua_parse(struct text_object *, char *, int);
uint8_t lua_barval(struct text_object *);
double lua_barval(struct text_object *);
#endif /* LUA_H_*/