Forward/backward compatibility

CoppeliaSim is developed by a small team. Unlike larger entities, we embrace an agile development methodology, which means a more frequent update cycle and rapid deployment of fixes. This approach may lead to occasional issues, but allows for swift resolution and the introduction of new features. User feedback, particularly through bug reports on the CoppeliaSim forum, is crucial to this process and is an important means of identifying and addressing problems.


Introduction of script objects in CoppeliaSim V4.7

Forward compatibility

Associated scripts remain operational, it is however recommended to convert them to script objects. Automatic conversion is not perfect, and several manual adjustments might have to be done, additionally.

Backward compatibility

Scenes and models containing script objects can be converted back to scenes and models containing only associated scripts, by setting the user settings parameter scriptConversion to -1. The related script code is however not touched by this conversion, and manual adjustments will have to be done.


In case of serious unexpected problems with script objects, one can revert to using old associated scripts, by setting the user settings parameter useSceneObjectScripts to false.


Introduction of buffers in CoppeliaSim V4.7

Forward compatibility

There are potentially two problematic situations with existing code:

  • Code that relies on the usage of the type-function will break with buffers, e.g.:
  • function sendData(data) if type(data) == 'string' then -- this does not execute when data is a buffer end end
  • Most API functions that clearly return binary data (e.g. sim.getVisionSensorImg) now return the data as a buffer. Comparing that buffer with a string will always resolve to false, e.g.:
  • print(sim.getVisionSensorImg(h) == anyStringData) -- always prints false
  • sim.packTable now returns a buffer of different length from previous CoppeliaSim versions (text/strings and buffers are now differentiated and this is reflected in the packed data), e.g.:
  • local packedTable1 = sim.packTable({'Txt'}) local packedTable2 = sim.packTable({'Txt\0'}) local packedTable3 = sim.packTable({tobuffer('Txt')}) print(packedTable1) -- prints: [buffer (16 bytes)] print(packedTable2) -- prints: [buffer (17 bytes) print(packedTable3) -- prints: [buffer (16 bytes) print(packedTable1 == packedTable2) -- prints: false print(packedTable1 == packedTable3) -- prints: false print(packedTable2 == packedTable3) -- prints: false print(sim.unpackTable(packedTable1)) -- prints: {'Txt'} print(sim.unpackTable(packedTable2)) -- prints: {[binary string (4 bytes)]} print(sim.unpackTable(packedTable3)) -- prints: {[buffer (3 bytes)]}

Workarounds:

  • Converting a buffer to string via tostring, before handing it to a code base that is not aware of buffers, is the best way to avoid potential problems
  • Where a buffer is compared to a string (and vice-versa), convert one or the other via tostring or tobuffer, otherwise comparison always resolves to false
  • Usage of buffers can be disabled in the user settings file with variable useBuffers

Backward compatibility

isbuffer and tobuffer are not recognized functions. Workaround:

  • Add following functions to lua/base.lua (alternatively to lua/sim.lua, or to a specific script code):
  • function tobuffer(a) return a end function isbuffer(a) return false end