Add luavgl_to_style method

custom
ailurux 1 year ago
parent 53c4ea7805
commit 490b067b76
  1. 5
      lib/luavgl/src/luavgl.h
  2. 11
      lib/luavgl/src/util.c

@ -157,6 +157,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
*

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

Loading…
Cancel
Save