diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-01-15 12:31:20 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-01-15 12:31:20 +1100 |
| commit | 7cdcd44e0ca10ebdc796638190ed1d9b45d99ef0 (patch) | |
| tree | 637b43848d17c9dbdc1688cb4733eb235f223e37 /src/lua/bridge.cpp | |
| parent | 0e04eb918ec976017276306181282769d8896c83 (diff) | |
| download | tangara-fw-7cdcd44e0ca10ebdc796638190ed1d9b45d99ef0.tar.gz | |
Begin migration of remaining screens to Lua
Diffstat (limited to 'src/lua/bridge.cpp')
| -rw-r--r-- | src/lua/bridge.cpp | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/src/lua/bridge.cpp b/src/lua/bridge.cpp index e7344e0e..82721d4e 100644 --- a/src/lua/bridge.cpp +++ b/src/lua/bridge.cpp @@ -37,21 +37,6 @@ namespace lua { static constexpr char kBridgeKey[] = "bridge"; -static auto open_settings_fn(lua_State* state) -> int { - events::Ui().Dispatch(ui::internal::ShowSettingsPage{ - .page = ui::internal::ShowSettingsPage::Page::kRoot}); - return 0; -} - -static const struct luaL_Reg kLegacyUiFuncs[] = { - {"open_settings", open_settings_fn}, - {NULL, NULL}}; - -static auto lua_legacy_ui(lua_State* state) -> int { - luaL_newlib(state, kLegacyUiFuncs); - return 1; -} - auto Bridge::Get(lua_State* state) -> Bridge* { lua_pushstring(state, kBridgeKey); lua_gettable(state, LUA_REGISTRYINDEX); @@ -64,9 +49,6 @@ Bridge::Bridge(system_fsm::ServiceLocator& services, lua_State& s) lua_pushlightuserdata(&s, this); lua_settable(&s, LUA_REGISTRYINDEX); - luaL_requiref(&s, "legacy_ui", lua_legacy_ui, true); - lua_pop(&s, 1); - luaL_requiref(&s, "linenoise", luaopen_linenoise, true); lua_pop(&s, 1); @@ -94,8 +76,7 @@ inline constexpr bool always_false_v = false; auto Bridge::AddPropertyModule( const std::string& name, - std::vector<std::pair<std::string, - std::variant<LuaFunction, std::shared_ptr<Property>>>> + std::vector<std::pair<std::string, std::variant<LuaFunction, Property*>>> props) -> void { // Create the module (or retrieve it if one with this name already exists) luaL_requiref(&state_, name.c_str(), new_property_module, true); @@ -107,8 +88,8 @@ auto Bridge::AddPropertyModule( using T = std::decay_t<decltype(arg)>; if constexpr (std::is_same_v<T, LuaFunction>) { bindings_.Register(&state_, arg); - } else if constexpr (std::is_same_v<T, std::shared_ptr<Property>>) { - bindings_.Register(&state_, arg.get()); + } else if constexpr (std::is_same_v<T, Property*>) { + bindings_.Register(&state_, arg); } else { static_assert(always_false_v<T>, "missing case"); } |
