Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarLuaConverters.hpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-24 23:37:55 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-24 23:37:55 +1000
commit8547c56ba4607e1c4efac483f97f01b8ba8c3a01 (patch)
treed156522eae042e07a1c430220e7d5ab1bfa2727f /source/core/StarLuaConverters.hpp
parent4c636e911ce86bcd6d501fc2f6f3ce2c3dd9c71c (diff)
Proper LuaString <-> String handling
Null-terminator usage is opt-in
Diffstat (limited to 'source/core/StarLuaConverters.hpp')
-rw-r--r--source/core/StarLuaConverters.hpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/core/StarLuaConverters.hpp b/source/core/StarLuaConverters.hpp
index eb06e35..72ab763 100644
--- a/source/core/StarLuaConverters.hpp
+++ b/source/core/StarLuaConverters.hpp
@@ -11,6 +11,23 @@
namespace Star {
+template <typename T>
+struct LuaConverter<LuaNullTermWrapper<T>> : LuaConverter<T> {
+ static LuaValue from(LuaEngine& engine, LuaNullTermWrapper<T>&& v) {
+ auto enforcer = engine.nullTerminate();
+ return LuaConverter<T>::from(std::forward<T>(v));
+ }
+
+ static LuaValue from(LuaEngine& engine, LuaNullTermWrapper<T> const& v) {
+ auto enforcer = engine.nullTerminate();
+ return LuaConverter<T>::from(v);
+ }
+
+ static LuaNullTermWrapper<T> to(LuaEngine& engine, LuaValue const& v) {
+ return LuaConverter<T>::to(v);
+ }
+};
+
template <typename T1, typename T2>
struct LuaConverter<pair<T1, T2>> {
static LuaValue from(LuaEngine& engine, pair<T1, T2>&& v) {