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

summaryrefslogtreecommitdiff
path: root/source/core/StarLua.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-02 10:55:25 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-02 10:55:25 +1000
commit73841ee041b8b52f5fde16dc272228704697bcb8 (patch)
tree6d7f05d090d11f5597841b689f19590797661198 /source/core/StarLua.cpp
parentfe3763ed33ed3ccd524c69ef3119bf125c59337d (diff)
more Input work
Diffstat (limited to 'source/core/StarLua.cpp')
-rw-r--r--source/core/StarLua.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/core/StarLua.cpp b/source/core/StarLua.cpp
index eb8541c..93ed516 100644
--- a/source/core/StarLua.cpp
+++ b/source/core/StarLua.cpp
@@ -125,7 +125,7 @@ LuaValue LuaConverter<Json>::from(LuaEngine& engine, Json const& v) {
} else if (v.isType(Json::Type::Int)) {
return LuaInt(v.toInt());
} else if (v.isType(Json::Type::String)) {
- return engine.createString(v.stringPtr()->utf8Ptr());
+ return engine.createString(*v.stringPtr());
} else {
return LuaDetail::jsonContainerToTable(engine, v);
}
@@ -451,7 +451,10 @@ ByteArray LuaEngine::compile(ByteArray const& contents, String const& name) {
}
LuaString LuaEngine::createString(String const& str) {
- return createString(str.utf8Ptr());
+ lua_checkstack(m_state, 1);
+
+ lua_pushlstring(m_state, str.utf8Ptr(), str.utf8Size());
+ return LuaString(LuaDetail::LuaHandle(RefPtr<LuaEngine>(this), popHandle(m_state)));
}
LuaString LuaEngine::createString(char const* str) {