In order to show editor window, click Show script editor option from Tools/VSScript menu. The script editor is a tool window in Visual Studio. That means you can place it on arbitrary position or dock it. The window behaves similar to the console window.
The script editor window contains a toolbar with a number of buttons. Below are short descriptions of most frequently used buttons, related to basic macro editing and execution. These functions are also available from main VSScript menu.
|Play||Click to execute the macro currently selected in the editor.|
|Stop||Click to abort execution of running macro. This is useful when it goes to infinite loop due to some error in the script.|
|Save||Click to save currently edited macro.|
|Go to error||Click to move the cursor to the next error line in currently selected macro (if exists).|
The editor marks errors by underlining them. You can view the error message by hovering mouse over particular code line. VSScript will display a tooltip window with the error message. Contents of these messages come directly from Lua interpreter. If you did not run your macro yet, only syntax errors are displayed. When you click Play button, additional runtime errors may also appear. Runtime and syntax errors are marked with different colors.
Use Go to error function to find nearest error.
VSScript editor offers some IntelliSense features for Lua language. When you type a dot or colon character (these are field or method access operators in Lua), VSScript will search for possible names which are applicable in current context. You will see either a list of methods or fields.
As Lua is a dynamically-typed language, it is not always possible to display such a list. VSScript uses a number of heuristics to determine the type of the expression you are currently entering. If that fails, the list just won't appear.
VSScript implements outlining for Lua, which works same as for other languages. You can access outlining functions from the context (right-click) menu.
Several additional language-specific editing functions are available from Edit/Advanced and Edit/Intelliense menus. You can comment or uncomment a region of code, it will use proper Lua comment tags. Another option is Complete word (Ctrl+Space). The editor will also highlight matching braces and parentheses (warning: in Visual Studio 2010 and 2012 the Fonts and Colors setting for brace matching is slightly buggy and you may have some trouble configuring it - it concerns not only VSScript but all languages).
Table of Contents