#ifndef LUA_CXX_HPP #define LUA_CXX_HPP extern "C" { #include } #include #include #include #include #include namespace getsuyomi { template using LuaResult = fud::Result; static_assert(std::is_convertible_v); class LuaContext { public: LuaContext(); ~LuaContext(); LuaContext(const LuaContext&) = delete; LuaContext(LuaContext&& rhs); LuaContext& operator=(const LuaContext&) = delete; LuaContext& operator=(LuaContext&& rhs); fud::FudStatus loadFile(const char* filename); LuaResult getGlobalInteger(const char* name); LuaResult getGlobalString(const char* name); LuaResult> getGlobalStringArray(const char* name); [[nodiscard]] constexpr bool valid() const { return m_state != nullptr; } private: lua_State *m_state{nullptr}; }; } // namespace getsuyomi #endif