#pragma once #include "lumacs/editor_core.hpp" #include "lumacs/theme.hpp" #include #include #include #include namespace lumacs { /// Lua scripting API for Lumacs class LuaApi { public: explicit LuaApi(EditorCore& core); ~LuaApi() = default; /// Get the Lua state [[nodiscard]] sol::state& state() { return lua_; } /// Load and execute a Lua file bool load_file(const std::filesystem::path& path); /// Execute Lua code bool execute(std::string_view code); /// Load init.lua from standard locations bool load_init_file(); /// Bind a key to a Lua function void bind_key(std::string key, sol::function callback); /// Check if a key has a binding [[nodiscard]] bool has_key_binding(const std::string& key) const; /// Execute key binding if it exists bool execute_key_binding(const std::string& key); /// Get all key bindings (for debugging) [[nodiscard]] std::map key_bindings() const { return key_bindings_; } private: sol::state lua_; EditorCore& core_; std::map key_bindings_; void setup_api(); void register_types(); void register_functions(); }; } // namespace lumacs