summaryrefslogtreecommitdiff
path: root/src/tangara/lua/lua_theme.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-05-02 21:41:56 +1000
committerjacqueline <me@jacqueline.id.au>2024-05-02 21:41:56 +1000
commit7d7f7755d17e1e0a2348d75d797097f166b70471 (patch)
tree1129eef470a90fc954a0c6f281e8d94fe0339101 /src/tangara/lua/lua_theme.cpp
parent1573a8c4cde1cd9528b422b2dcc598e37ffe94a7 (diff)
downloadtangara-fw-7d7f7755d17e1e0a2348d75d797097f166b70471.tar.gz
start moving include files into subdirs
Diffstat (limited to 'src/tangara/lua/lua_theme.cpp')
-rw-r--r--src/tangara/lua/lua_theme.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/tangara/lua/lua_theme.cpp b/src/tangara/lua/lua_theme.cpp
index 72434d97..5edde104 100644
--- a/src/tangara/lua/lua_theme.cpp
+++ b/src/tangara/lua/lua_theme.cpp
@@ -5,20 +5,20 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "lua_version.hpp"
+#include "lua/lua_version.hpp"
#include <string>
-#include "bridge.hpp"
#include "lua.hpp"
+#include "lua/bridge.hpp"
#include "esp_app_desc.h"
#include "esp_log.h"
#include "lauxlib.h"
#include "lua.h"
-#include "lua_thread.hpp"
+#include "lua/lua_thread.hpp"
#include "luavgl.h"
-#include "themes.hpp"
+#include "ui/themes.hpp"
namespace lua {
@@ -35,7 +35,7 @@ static auto set_style(lua_State* L) -> int {
static auto set_theme(lua_State* L) -> int {
std::string class_name;
luaL_checktype(L, -1, LUA_TTABLE);
- lua_pushnil(L); /* first key */
+ lua_pushnil(L); /* first key */
while (lua_next(L, -2) != 0) {
/* uses 'key' (at index -2) and 'value' (at index -1) */
if (lua_type(L, -2) == LUA_TSTRING) {
@@ -43,11 +43,11 @@ static auto set_theme(lua_State* L) -> int {
}
if (lua_type(L, -1) == LUA_TTABLE) {
// Nesting
- lua_pushnil(L); // First key
+ lua_pushnil(L); // First key
while (lua_next(L, -2) != 0) {
// Nesting the second
int selector = -1;
- lua_pushnil(L); // First key
+ lua_pushnil(L); // First key
while (lua_next(L, -2) != 0) {
int idx = lua_tointeger(L, -2);
if (idx == 1) {
@@ -60,12 +60,13 @@ static auto set_theme(lua_State* L) -> int {
ESP_LOGI("lua_theme", "Style was null or malformed");
return 0;
} else {
- ui::themes::Theme::instance()->AddStyle(class_name, selector, style);
+ ui::themes::Theme::instance()->AddStyle(class_name, selector,
+ style);
}
}
- lua_pop(L, 1);
+ lua_pop(L, 1);
}
- lua_pop(L, 1);
+ lua_pop(L, 1);
}
}
/* removes 'value'; keeps 'key' for next iteration */
@@ -74,7 +75,9 @@ static auto set_theme(lua_State* L) -> int {
return 0;
}
-static const struct luaL_Reg kThemeFuncs[] = {{"set", set_theme}, {"set_style", set_style}, {NULL, NULL}};
+static const struct luaL_Reg kThemeFuncs[] = {{"set", set_theme},
+ {"set_style", set_style},
+ {NULL, NULL}};
static auto lua_theme(lua_State* L) -> int {
luaL_newlib(L, kThemeFuncs);