1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 00:25:19 +02:00

Allow buffer argument to VoxelManip:get_light_data (#12682)

This commit is contained in:
Jude Melton-Houghton
2022-08-13 02:53:47 -04:00
committed by GitHub
parent 59601eb922
commit ab8dfb45b4
3 changed files with 14 additions and 2 deletions

View File

@@ -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);