lua: fix color string push

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-07-24 17:56:42 +02:00
parent 21f1f4cf0a
commit 8502eb3299
1 changed files with 3 additions and 1 deletions

4
lua.c
View File

@ -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));
} }