From 1573a8c4cde1cd9528b422b2dcc598e37ffe94a7 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 2 May 2024 19:12:26 +1000 Subject: WIP merge cyclically dependent components into one big component --- src/tangara/lua/lua_thread.hpp | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/tangara/lua/lua_thread.hpp (limited to 'src/tangara/lua/lua_thread.hpp') diff --git a/src/tangara/lua/lua_thread.hpp b/src/tangara/lua/lua_thread.hpp new file mode 100644 index 00000000..384de61d --- /dev/null +++ b/src/tangara/lua/lua_thread.hpp @@ -0,0 +1,44 @@ +/* + * Copyright 2023 jacqueline + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#pragma once + +#include +#include + +#include "lua.hpp" + +#include "service_locator.hpp" + +namespace lua { + +class Allocator; + +auto CallProtected(lua_State*, int nargs, int nresults) -> int; + +class LuaThread { + public: + static auto Start(system_fsm::ServiceLocator&) -> LuaThread*; + ~LuaThread(); + + auto RunScript(const std::string& path) -> bool; + auto RunString(const std::string& path) -> bool; + + auto DumpStack() -> void; + + auto state() -> lua_State* { return state_; } + + LuaThread(const LuaThread&) = delete; + LuaThread& operator=(const LuaThread&) = delete; + + private: + LuaThread(std::unique_ptr&, lua_State*); + + std::unique_ptr alloc_; + lua_State* state_; +}; + +} // namespace lua -- cgit v1.2.3 From 7d7f7755d17e1e0a2348d75d797097f166b70471 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 2 May 2024 21:41:56 +1000 Subject: start moving include files into subdirs --- src/tangara/lua/lua_thread.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tangara/lua/lua_thread.hpp') diff --git a/src/tangara/lua/lua_thread.hpp b/src/tangara/lua/lua_thread.hpp index 384de61d..d7602c1e 100644 --- a/src/tangara/lua/lua_thread.hpp +++ b/src/tangara/lua/lua_thread.hpp @@ -11,7 +11,7 @@ #include "lua.hpp" -#include "service_locator.hpp" +#include "system_fsm/service_locator.hpp" namespace lua { -- cgit v1.2.3