aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_vmanip.cpp
diff options
context:
space:
mode:
authorJude Melton-Houghton <jwmhjwmh@gmail.com>2022-08-13 02:53:47 -0400
committerGitHub <noreply@github.com>2022-08-13 08:53:47 +0200
commitab8dfb45b4e1f6b2c331cc9b8a367ae81cd16f42 (patch)
treeffb0f65b0792eebdf87a68ab8a7351e87799c06f /src/script/lua_api/l_vmanip.cpp
parent59601eb9229032f8126f9ff11598faf25357ca44 (diff)
downloadminetest-ab8dfb45b4e1f6b2c331cc9b8a367ae81cd16f42.tar.xz
Allow buffer argument to VoxelManip:get_light_data (#12682)
Diffstat (limited to 'src/script/lua_api/l_vmanip.cpp')
-rw-r--r--src/script/lua_api/l_vmanip.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/script/lua_api/l_vmanip.cpp b/src/script/lua_api/l_vmanip.cpp
index 6187a47db..f6426771f 100644
--- a/src/script/lua_api/l_vmanip.cpp
+++ b/src/script/lua_api/l_vmanip.cpp
@@ -260,11 +260,17 @@ int LuaVoxelManip::l_get_light_data(lua_State *L)
NO_MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1);
+ bool use_buffer = lua_istable(L, 2);
+
MMVManip *vm = o->vm;
u32 volume = vm->m_area.getVolume();
- lua_createtable(L, volume, 0);
+ if (use_buffer)
+ lua_pushvalue(L, 2);
+ else
+ lua_createtable(L, volume, 0);
+
for (u32 i = 0; i != volume; i++) {
lua_Integer light = vm->m_data[i].param1;
lua_pushinteger(L, light);