mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
update file.write_bytes to support bytearray + bit_converter bytearray support
This commit is contained in:
parent
6bf23e5cac
commit
bfdd92ca51
2 changed files with 10 additions and 7 deletions
|
|
@ -141,10 +141,13 @@ static int l_file_write_bytes(lua::State* L) {
|
|||
|
||||
fs::path path = resolve_path(lua::require_string(L, pathIndex));
|
||||
|
||||
if (auto bytearray = lua::touserdata<lua::Bytearray>(L, -1)) {
|
||||
auto& bytes = bytearray->data();
|
||||
return lua::pushboolean(L, files::write_bytes(path, bytes.data(), bytes.size()));
|
||||
}
|
||||
|
||||
std::vector<ubyte> bytes;
|
||||
|
||||
int result = read_bytes_from_table(L, -1, bytes);
|
||||
|
||||
if(result != 1) {
|
||||
return result;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue