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

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

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

by paramat » Post

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

Code: Select all

vm:write_to_map(data)
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.

Locked

Who is online

Users browsing this forum: No registered users and 1 guest