Merge branch 'main' into dev

This commit is contained in:
MihailRis
2025-10-01 00:07:53 +03:00
23 changed files with 153 additions and 87 deletions
+1 -2
View File
@@ -33,8 +33,7 @@ static int l_tostring(lua::State* L) {
lua::pop(L);
return lua::pushlstring(L, buffer.data(), size);
} else {
lua::bytearray_as_string(L, 1);
return 1;
return lua::pushlstring(L, lua::bytearray_as_string(L, 1));
}
}
-1
View File
@@ -133,7 +133,6 @@ dv::value lua::tovalue(State* L, int idx) {
auto bytes = std::make_shared<dv::objects::Bytes>(
reinterpret_cast<const ubyte*>(data.data()), data.size()
);
pop(L);
return bytes;
}
}
+5 -2
View File
@@ -768,9 +768,12 @@ namespace lua {
}
inline std::string_view bytearray_as_string(lua::State* L, int idx) {
lua::requireglobal(L, "Bytearray_as_string");
lua::pushvalue(L, idx);
lua::requireglobal(L, "Bytearray_as_string");
lua::pushvalue(L, -2);
lua::call(L, 1, 1);
return lua::tolstring(L, -1);
auto view = lua::tolstring(L, -1);
lua::pop(L, 2);
return view;
}
}