lua: fix color string push
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
21f1f4cf0a
commit
8502eb3299
4
lua.c
4
lua.c
|
@ -685,5 +685,7 @@ luaA_pushcolor(lua_State *L, const xcolor_t *c)
|
||||||
uint8_t g = (unsigned)c->green * 0xff / 0xffff;
|
uint8_t g = (unsigned)c->green * 0xff / 0xffff;
|
||||||
uint8_t b = (unsigned)c->blue * 0xff / 0xffff;
|
uint8_t b = (unsigned)c->blue * 0xff / 0xffff;
|
||||||
uint8_t a = (unsigned)c->alpha * 0xff / 0xffff;
|
uint8_t a = (unsigned)c->alpha * 0xff / 0xffff;
|
||||||
lua_pushfstring(L, "#%02x%02x%02x%02x", r, g, b, a);
|
char s[10];
|
||||||
|
snprintf(s, sizeof(s), "#%02x%02x%02x%02x", r, g, b, a);
|
||||||
|
lua_pushlstring(L, s, sizeof(s));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue