Widespread incorrect usage of 'vm:write_to_map(data)'

User avatar
Posts: 3435
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Widespread incorrect usage of 'vm:write_to_map(data)'

by paramat » Sat Sep 23, 2017 06:08

When the Lua Voxel Manipulator was added by hmmmm, he posted an example in https://forum.minetest.net/viewtopic.php?f=18&t=6396 which had the usage:

Code: Select all

This usage i copied and many copied my usage, however the 'data' argument was never needed here and was a mistake by hmmmm, this unnecessary added argument did not break anything, it simply had no effect.

It is now more important to realise this incorrect usage as 'vm:write_to_map()' now does use an optional argument for another purpose:

Code: Select all
* `write_to_map([light])`: Writes the data loaded from the `VoxelManip` back to the map.
    * **important**: data must be set using `VoxelManip:set_data()` before calling this
    * if `light` is true, then lighting is automatically recalculated.
      The default value is true.
      If `light` is false, no light calculations happen, and you should correct
      all modified blocks with `minetest.fix_light()` as soon as possible.
      Keep in mind that modifying the map where light is incorrect can cause
      more lighting bugs.

Return to News

Who is online

Users browsing this forum: No registered users and 1 guest