diff options
| author | ailurux <ailuruxx@gmail.com> | 2024-03-28 16:29:23 +1100 |
|---|---|---|
| committer | ailurux <ailuruxx@gmail.com> | 2024-03-28 16:29:23 +1100 |
| commit | 79b6c3b393a1ff351b437ef59b2a4e472da0c38c (patch) | |
| tree | 7742154d00e9aaa1271ce8c75f16ed69322951d4 /src/lua | |
| parent | c8e67cbd80b53a4e889ce0485546042d5490918c (diff) | |
| download | tangara-fw-79b6c3b393a1ff351b437ef59b2a4e472da0c38c.tar.gz | |
Use luaL_checkstring in set_style
Diffstat (limited to 'src/lua')
| -rw-r--r-- | src/lua/lua_theme.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/lua/lua_theme.cpp b/src/lua/lua_theme.cpp index 4eb46499..d7f099cc 100644 --- a/src/lua/lua_theme.cpp +++ b/src/lua/lua_theme.cpp @@ -24,12 +24,10 @@ namespace lua { static auto set_style(lua_State* L) -> int { // Get the object and class name from the stack - if (lua_type(L, -1) == LUA_TSTRING) { - std::string class_name = lua_tostring(L, -1); - lv_obj_t* obj = luavgl_to_obj(L, -2); - if (obj != NULL) { - ui::themes::Theme::instance()->ApplyStyle(obj, class_name); - } + std::string class_name = luaL_checkstring(L, -1); + lv_obj_t* obj = luavgl_to_obj(L, -2); + if (obj != NULL) { + ui::themes::Theme::instance()->ApplyStyle(obj, class_name); } return 0; } |
