From bca28b3a66f66365a5062c1bb8340719b9787bc5 Mon Sep 17 00:00:00 2001 From: Neo Xu Date: Tue, 22 Oct 2024 01:27:23 +0800 Subject: [PATCH] obj: allow chain set of obj style API Return the obj so we can do obj:add_style():remove_style() etc. Signed-off-by: Neo Xu --- src/style.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/style.c b/src/style.c index 0b7eca8..4676a70 100644 --- a/src/style.c +++ b/src/style.c @@ -679,7 +679,8 @@ static int luavgl_obj_set_style(lua_State *L) lua_pop(L, 1); /* remove value, keep the key to continue. */ } - return 0; + lua_settop(L, 1); + return 1; } /** @@ -697,7 +698,8 @@ static int luavgl_obj_add_style(lua_State *L) lv_obj_add_style(obj, &s->style, selector); - return 0; + lua_settop(L, 1); + return 1; } /** @@ -714,7 +716,9 @@ static int luavgl_obj_remove_style(lua_State *L) } lv_obj_remove_style(obj, &s->style, selector); - return 0; + + lua_settop(L, 1); + return 1; } /** @@ -725,7 +729,8 @@ static int luavgl_obj_remove_style_all(lua_State *L) lv_obj_t *obj = luavgl_to_obj(L, 1); lv_obj_remove_style_all(obj); - return 0; + lua_settop(L, 1); + return 1; } static const rotable_Reg luavgl_style_methods[] = {