diff options
| author | cooljqln <cooljqln@noreply.codeberg.org> | 2024-03-28 05:36:38 +0000 |
|---|---|---|
| committer | cooljqln <cooljqln@noreply.codeberg.org> | 2024-03-28 05:36:38 +0000 |
| commit | 0175eaf1b5e79c53ac86adc568b67f018a5a7daf (patch) | |
| tree | d6b380746fb011c46c1c1aa2946005c6971a9c4e /lib/luavgl/src | |
| parent | 35a822fe602cdc9e3a3482df3913ea33af6fc8c2 (diff) | |
| parent | 7c5dae84175aa750ca1b8beeb066f5607ca73181 (diff) | |
| download | tangara-fw-0175eaf1b5e79c53ac86adc568b67f018a5a7daf.tar.gz | |
Merge pull request 'themes' (#58) from themes into main
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/58
Reviewed-by: cooljqln <cooljqln@noreply.codeberg.org>
Diffstat (limited to 'lib/luavgl/src')
| -rw-r--r-- | lib/luavgl/src/luavgl.h | 5 | ||||
| -rw-r--r-- | lib/luavgl/src/util.c | 11 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/luavgl/src/luavgl.h b/lib/luavgl/src/luavgl.h index b26bb5c7..c76a6493 100644 --- a/lib/luavgl/src/luavgl.h +++ b/lib/luavgl/src/luavgl.h @@ -158,6 +158,11 @@ LUALIB_API int luavgl_obj_getuserdatauv(lua_State *L, int idx); LUALIB_API lv_obj_t *luavgl_to_obj(lua_State *L, int idx); /** + * @brief Get lvgl style from stack + */ +LUALIB_API lv_style_t *luavgl_to_style(lua_State *L, int idx); + +/** * @brief Convert value to integer * * Supported values are: integer, float, boolean diff --git a/lib/luavgl/src/util.c b/lib/luavgl/src/util.c index 2042a6d9..7fb86906 100644 --- a/lib/luavgl/src/util.c +++ b/lib/luavgl/src/util.c @@ -272,6 +272,17 @@ LUALIB_API lv_obj_t *luavgl_to_obj(lua_State *L, int idx) return lobj->obj; } +LUALIB_API lv_style_t *luavgl_to_style(lua_State *L, int idx) +{ + luavgl_style_t *lsty = luavgl_check_style(L, idx); + if (lsty == NULL) { + luaL_argerror(L, idx, "expect lua lvgl style, got null"); + return NULL; + } + + return &lsty->style; +} + LUALIB_API int luavgl_tointeger(lua_State *L, int idx) { int v = 0; |
