File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -3263,7 +3263,9 @@ will place the schematic inside of the VoxelManip.
3263
3263
* `set_light_data(light_data)`: Sets the `param1` (light) contents of each node
3264
3264
in the `VoxelManip`
3265
3265
* expects lighting data in the same format that `get_light_data()` returns
3266
- * `get_param2_data()`: Gets the raw `param2` data read into the `VoxelManip` object
3266
+ * `get_param2_data([buffer])`: Gets the raw `param2` data read into the `VoxelManip` object
3267
+ * Returns an array (indices 1 to volume) of integers ranging from `0` to `255`
3268
+ * If the param `buffer` is present, this table will be used to store the result instead
3267
3269
* `set_param2_data(param2_data)`: Sets the `param2` contents of each node in the `VoxelManip`
3268
3270
* `calc_lighting([p1, p2], [propagate_shadow])`: Calculate lighting within the `VoxelManip`
3269
3271
* To be used only by a `VoxelManip` object from `minetest.get_mapgen_object`
Original file line number Diff line number Diff line change @@ -277,11 +277,17 @@ int LuaVoxelManip::l_get_param2_data(lua_State *L)
277
277
NO_MAP_LOCK_REQUIRED;
278
278
279
279
LuaVoxelManip *o = checkobject (L, 1 );
280
+ bool use_buffer = lua_istable (L, 2 );
281
+
280
282
MMVManip *vm = o->vm ;
281
283
282
284
u32 volume = vm->m_area .getVolume ();
283
285
284
- lua_newtable (L);
286
+ if (use_buffer)
287
+ lua_pushvalue (L, 2 );
288
+ else
289
+ lua_newtable (L);
290
+
285
291
for (u32 i = 0 ; i != volume; i++) {
286
292
lua_Integer param2 = vm->m_data [i].param2 ;
287
293
lua_pushinteger (L, param2);
You can’t perform that action at this time.
0 commit comments