summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-08-29 15:52:34 +1000
committerjacqueline <me@jacqueline.id.au>2024-08-29 15:52:34 +1000
commit91eaed4b37c7cda29103d3478df3e2c6356f8396 (patch)
treede317a6a9b595ee744058db55af0f3f40ea89af8 /src
parent96a224c0df4f647b3e5dbbcbbedad3a1d38470ba (diff)
downloadtangara-fw-91eaed4b37c7cda29103d3478df3e2c6356f8396.tar.gz
use snake_case consistently in lua function names
Diffstat (limited to 'src')
-rw-r--r--src/tangara/lua/lua_screen.cpp6
-rw-r--r--src/tangara/ui/screen_lua.cpp6
-rw-r--r--src/tangara/ui/ui_fsm.cpp2
3 files changed, 7 insertions, 7 deletions
diff --git a/src/tangara/lua/lua_screen.cpp b/src/tangara/lua/lua_screen.cpp
index 8d87eebd..6bb26ec1 100644
--- a/src/tangara/lua/lua_screen.cpp
+++ b/src/tangara/lua/lua_screen.cpp
@@ -56,9 +56,9 @@ static auto screen_true(lua_State* state) -> int {
}
static const struct luaL_Reg kScreenFuncs[] = {
- {"new", screen_new}, {"createUi", screen_noop},
- {"onShown", screen_noop}, {"onHidden", screen_noop},
- {"canPop", screen_true}, {NULL, NULL}};
+ {"new", screen_new}, {"create_ui", screen_noop},
+ {"on_show", screen_noop}, {"on_hide", screen_noop},
+ {"can_pop", screen_true}, {NULL, NULL}};
static auto lua_screen(lua_State* state) -> int {
luaL_newlib(state, kScreenFuncs);
diff --git a/src/tangara/ui/screen_lua.cpp b/src/tangara/ui/screen_lua.cpp
index 301df143..b8d11ed7 100644
--- a/src/tangara/ui/screen_lua.cpp
+++ b/src/tangara/ui/screen_lua.cpp
@@ -29,7 +29,7 @@ Lua::~Lua() {
}
auto Lua::onShown() -> void {
- callMethod("onShown");
+ callMethod("on_show");
forEachBinding([&](lua::Binding* b) {
b->active = true;
lua::Binding::apply(s_, -1);
@@ -37,7 +37,7 @@ auto Lua::onShown() -> void {
}
auto Lua::onHidden() -> void {
- callMethod("onHidden");
+ callMethod("on_hide");
forEachBinding([&](lua::Binding* b) { b->active = false; });
}
@@ -46,7 +46,7 @@ auto Lua::canPop() -> bool {
return true;
}
lua_rawgeti(s_, LUA_REGISTRYINDEX, *obj_ref_);
- lua_pushliteral(s_, "canPop");
+ lua_pushliteral(s_, "can_pop");
if (lua_gettable(s_, -2) == LUA_TFUNCTION) {
// If we got a callback instead of a value, then invoke it to turn it into
diff --git a/src/tangara/ui/ui_fsm.cpp b/src/tangara/ui/ui_fsm.cpp
index 669b3298..2009a888 100644
--- a/src/tangara/ui/ui_fsm.cpp
+++ b/src/tangara/ui/ui_fsm.cpp
@@ -754,7 +754,7 @@ auto Lua::PushLuaScreen(lua_State* s, bool replace) -> int {
// Call the constructor for this screen.
// lua_settop(s, 1); // Make sure the screen is actually at top of stack
- lua_pushliteral(s, "createUi");
+ lua_pushliteral(s, "create_ui");
if (lua_gettable(s, 1) == LUA_TFUNCTION) {
lua_pushvalue(s, 1);
lua::CallProtected(s, 1, 0);