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 the selected word
  • source folding/unfolding
  • search and replace function
  • no need for explicit saving
  • jump to specific function
  • undo/redo
  • inspection/edition of included files
  • The API functions can easily be accessed by typing the first 3 letters (usually "sim"). 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. The user can also explicitely restart/reset a given script, for changes to take immediately effect.

    If you have recurring functions you wish to access from a given script, or if you simply wish to run code from an external file, you can do this with following:

    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. Searched path are usually following:

  • <V-REP executable>/
  • <V-REP executable>/lua/
  • <current scene path>/
  • <additional search path>/ (this path can be specified with variable additionalLuaPath in file system/usrset.txt)
  • Files included via the require directive can be opened in the same script editor by opening the popup menu over the file name.



    Recommended topics

  • Script properties