Merge branch 'main' into dev
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user