From ab8dfb45b4e1f6b2c331cc9b8a367ae81cd16f42 Mon Sep 17 00:00:00 2001 From: Jude Melton-Houghton Date: Sat, 13 Aug 2022 02:53:47 -0400 Subject: Allow buffer argument to VoxelManip:get_light_data (#12682) --- src/script/lua_api/l_vmanip.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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); -- cgit v1.2.3