diff --git a/src/core.c b/src/core.c index 1b1f6fb1..842709a0 100644 --- a/src/core.c +++ b/src/core.c @@ -1330,7 +1330,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long } else { CRIT_ERR(obj, free_at_crash, "lua_bar needs arguments: , [function parameters]"); } - obj->callbacks.print = &print_lua_bar; + obj->callbacks.barval = &lua_barval; obj->callbacks.free = &gen_free_opaque; #ifdef X11 END OBJ_ARG(lua_graph, 0, "lua_graph needs arguments: [height],[width] [gradient colour 1] [gradient colour 2] [scale] [-t] [-l]") diff --git a/src/llua.c b/src/llua.c index bb9b2d32..8c12a2f7 100644 --- a/src/llua.c +++ b/src/llua.c @@ -546,12 +546,13 @@ void print_lua_parse(struct text_object *obj, char *p, int p_max_size) } } -void print_lua_bar(struct text_object *obj, char *p, int p_max_size) +uint8_t lua_barval(struct text_object *obj) { double per; if (llua_getnumber(obj->data.s, &per)) { - new_bar(obj, p, p_max_size, (per/100.0 * 255)); + return round_to_int(per * 2.55); } + return 0; } #ifdef X11 diff --git a/src/llua.h b/src/llua.h index 0c940342..291b2e77 100644 --- a/src/llua.h +++ b/src/llua.h @@ -67,7 +67,7 @@ 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); -void print_lua_bar(struct text_object *, char *, int); +uint8_t lua_barval(struct text_object *); #ifdef X11 void print_lua_graph(struct text_object *, char *, int); #endif /* X11 */