summaryrefslogtreecommitdiff
path: root/src/lua/include/bridge.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/include/bridge.hpp')
-rw-r--r--src/lua/include/bridge.hpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/lua/include/bridge.hpp b/src/lua/include/bridge.hpp
index 62fbc340..64f14e0e 100644
--- a/src/lua/include/bridge.hpp
+++ b/src/lua/include/bridge.hpp
@@ -16,25 +16,38 @@
namespace lua {
+/*
+ * Responsible for adding C/C++ module bindings to Lua threads. This class
+ * keeps no thread-specific internal state, and instead uses the LUA_REGISTRY
+ * table of its host threads to store data.
+ */
class Bridge {
public:
+ /*
+ * Utility for retrieving the Bridge from a Lua thread in which the Bridge's
+ * bindings have been installed. Use by Lua's C callbacks to access the rest
+ * of the system.
+ */
static auto Get(lua_State* state) -> Bridge*;
- Bridge(system_fsm::ServiceLocator&, lua_State& s);
+ Bridge(system_fsm::ServiceLocator& s);
- auto AddPropertyModule(
+ system_fsm::ServiceLocator& services() { return services_; }
+
+ auto installBaseModules(lua_State* L) -> void;
+ auto installLvgl(lua_State* L) -> void;
+ auto installPropertyModule(
+ lua_State* L,
const std::string&,
std::vector<
- std::pair<std::string,
- std::variant<LuaFunction, Property*>>>)
+ std::pair<std::string, std::variant<LuaFunction, Property*>>>&)
-> void;
- system_fsm::ServiceLocator& services() { return services_; }
- PropertyBindings& bindings() { return bindings_; }
+ Bridge(const Bridge&) = delete;
+ Bridge& operator=(const Bridge&) = delete;
private:
system_fsm::ServiceLocator& services_;
- lua_State& state_;
PropertyBindings bindings_;
};