diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/script/lua_api/l_vmanip.cpp | 8 |
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); |