Script editor

The script editor allows editing the various scripts in V-REP. It is opened by double-clicking a script in the script dialog, or by double-clicking a script icon in the scene hierarchy.

[Script editor]

The script editor has following features that make the code edition easier:

  • auto-completion
  • call tips
  • syntax highlighting
  • Highlighting of all occurrences of selected word
  • source folding/unfolding
  • simple word search via the <ctrl+f> key
  • no need for explicit saving
  • The API functions can easily be accessed by typing the first 3 letters (usually "sim"). Copy/paste and undo/redo functionality of the script editor is supported through a popup menu (right-click). When a script was modified, there is no need to explicitly save the changes: closing the script editor, saving the scene or starting a simulation will automatically apply the changes to the script. When a simulation is running, modifications to a given script will only have an effect once a new simulation run is started, except for customization scripts that will always apply changes once the editor was closed.

    If you have recurring functions you wish to access from a given script, you can add following line at the top of your script:

    require "myExternalLuaFile"

    In that case, make sure the file is named myExternalLuaFile.lua, and do not forget to distribute it together with your scene or model, since that code will not be part of a V-REP file anymore.

    It can also be convenient to include the code from an external lua script, for ease of maintenance, or simply if you wish to use the same script content for several scripts:


    Above way of including scripts will also allow you to edit your script content with an external editor. Remember however that you will also have to distribute the external files, when distributing your scene or model.

    Recommended topics

  • Script properties