mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 22:11:51 +00:00
add Bytearray support to world.set_chunk_data(...)
This commit is contained in:
parent
eaff5643a3
commit
c9adbe80ea
1 changed files with 3 additions and 3 deletions
|
|
@ -160,13 +160,13 @@ static void integrate_chunk_client(Chunk& chunk) {
|
||||||
static int l_set_chunk_data(lua::State* L) {
|
static int l_set_chunk_data(lua::State* L) {
|
||||||
int x = static_cast<int>(lua::tointeger(L, 1));
|
int x = static_cast<int>(lua::tointeger(L, 1));
|
||||||
int z = static_cast<int>(lua::tointeger(L, 2));
|
int z = static_cast<int>(lua::tointeger(L, 2));
|
||||||
auto buffer = lua::touserdata<lua::LuaBytearray>(L, 3);
|
auto buffer = lua::require_bytearray(L, 3);
|
||||||
auto chunk = level->chunks->getChunk(x, z);
|
auto chunk = level->chunks->getChunk(x, z);
|
||||||
if (chunk == nullptr) {
|
if (chunk == nullptr) {
|
||||||
return 0;
|
return lua::pushboolean(L, false);
|
||||||
}
|
}
|
||||||
compressed_chunks::decode(
|
compressed_chunks::decode(
|
||||||
*chunk, buffer->data().data(), buffer->data().size()
|
*chunk, buffer.data(), buffer.size()
|
||||||
);
|
);
|
||||||
if (controller->getChunksController()->lighting == nullptr) {
|
if (controller->getChunksController()->lighting == nullptr) {
|
||||||
return lua::pushboolean(L, true);
|
return lua::pushboolean(L, true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue