diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-04 22:36:27 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-04 22:36:27 +1000 |
commit | c923f4f13b1cade968bb6fec585a242b62d35715 (patch) | |
tree | 94bc9f9098c007070d3644f077e6f544c4fd43a4 /source/core | |
parent | 5df9adcd0ecbf09ae2ba426b3eeab78296d370c4 (diff) |
pane lua stuff
Diffstat (limited to 'source/core')
-rw-r--r-- | source/core/StarLua.hpp | 7 | ||||
-rw-r--r-- | source/core/StarLuaConverters.cpp | 12 | ||||
-rw-r--r-- | source/core/StarLuaConverters.hpp | 6 |
3 files changed, 22 insertions, 3 deletions
diff --git a/source/core/StarLua.hpp b/source/core/StarLua.hpp index 41310a3..500923d 100644 --- a/source/core/StarLua.hpp +++ b/source/core/StarLua.hpp @@ -526,6 +526,10 @@ public: template <typename Return, typename... Args, typename Function> LuaFunction createFunctionWithSignature(Function&& func); + LuaFunction createWrappedFunction(LuaDetail::LuaWrappedFunction function); + + LuaFunction createRawFunction(lua_CFunction func); + LuaThread createThread(); template <typename T> @@ -639,9 +643,6 @@ private: int placeHandle(); - LuaFunction createWrappedFunction(LuaDetail::LuaWrappedFunction function); - LuaFunction createRawFunction(lua_CFunction func); - void pushLuaValue(lua_State* state, LuaValue const& luaValue); LuaValue popLuaValue(lua_State* state); diff --git a/source/core/StarLuaConverters.cpp b/source/core/StarLuaConverters.cpp index 9cd44e3..e170da5 100644 --- a/source/core/StarLuaConverters.cpp +++ b/source/core/StarLuaConverters.cpp @@ -39,4 +39,16 @@ Maybe<Color> LuaConverter<Color>::to(LuaEngine& engine, LuaValue const& v) { return {}; } +LuaValue LuaConverter<LuaCallbacks>::from(LuaEngine& engine, LuaCallbacks const& c) { + auto table = engine.createTable(0, c.callbacks().size()); + for (auto& callback : c.callbacks()) + table.set(callback.first, engine.createWrappedFunction(callback.second)); + + return table; +} + +Maybe<LuaCallbacks> LuaConverter<LuaCallbacks>::to(LuaEngine& engine, LuaValue const& v) { + return {}; +} + } diff --git a/source/core/StarLuaConverters.hpp b/source/core/StarLuaConverters.hpp index c20442f..eb06e35 100644 --- a/source/core/StarLuaConverters.hpp +++ b/source/core/StarLuaConverters.hpp @@ -259,6 +259,12 @@ struct LuaConverter<Color> { static Maybe<Color> to(LuaEngine& engine, LuaValue const& v); }; +template <> +struct LuaConverter<LuaCallbacks> { + static LuaValue from(LuaEngine& engine, LuaCallbacks const& c); + static Maybe<LuaCallbacks> to(LuaEngine& engine, LuaValue const& v); +}; + } #endif |