Use luaL_checkstring in set_style

custom
ailurux 1 year ago
parent c8e67cbd80
commit 79b6c3b393
  1. 4
      src/lua/lua_theme.cpp

@ -24,13 +24,11 @@ namespace lua {
static auto set_style(lua_State* L) -> int { static auto set_style(lua_State* L) -> int {
// Get the object and class name from the stack // Get the object and class name from the stack
if (lua_type(L, -1) == LUA_TSTRING) { std::string class_name = luaL_checkstring(L, -1);
std::string class_name = lua_tostring(L, -1);
lv_obj_t* obj = luavgl_to_obj(L, -2); lv_obj_t* obj = luavgl_to_obj(L, -2);
if (obj != NULL) { if (obj != NULL) {
ui::themes::Theme::instance()->ApplyStyle(obj, class_name); ui::themes::Theme::instance()->ApplyStyle(obj, class_name);
} }
}
return 0; return 0;
} }

Loading…
Cancel
Save