Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion _doc/wurstbeginner.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,42 @@ Let's go through all the files:
- **/wurst** All files in this folder that end with **.wurst, .jurst, .j** will be parsed as code.
- **.gitignore** Useful template if you want to make your wurst project a git repo as well
- **ExampleMap.w3x** An example tft map containing a Bloodmage
- **wurst_run.args** Defines a set of flags to use when running a map from VSCode
- **wurst_run.args** Sets [compiler arguments](#compiler-arguments) for running and building the map.
- **wurst.build** Contains project build information
- **wurst/Hello.wurst** Demo package

{: .answer}
* *{: .fa .fa-exclamation-circle} Make sure to always open a .wurst file. Otherwise the vscode plugin might not load.

## Compiler arguments

Put `wurst_run.args` beside `wurst.build`. Write one compiler option per line. Blank lines and lines beginning with `#` are ignored.

| In `wurst_run.args` | VS Code Run | VS Code Hot run | Release build |
| --- | --- | --- | --- |
| `-option` | Yes | Yes | Yes |
| `+option` | | | Yes |

The build converts `+option` to `-option` before passing it to the compiler. This lets you keep local runs easy to debug and enable optimizations for release builds.

```text
# Shared by run and build
-runcompiletimefunctions
-injectobjects
-stacktraces

# Release builds only
+opt
+inline
+localOptimizations
```

`-runcompiletimefunctions` runs compile-time Wurst functions such as object generators. `-injectobjects` puts their generated object data into the map. `-stacktraces` adds Wurst call stacks to runtime errors. The last three options enable general optimization, inlining, and local optimizations. This split matches the [downloadable template](https://github.com/wurstscript/wurst-project-template#compiler-options).

VS Code appends the arguments for the selected command after the file options. When invoking the compiler jar with a workspace, the CLI reads the same file and adds the applicable options to its command line. In either case, keep project settings such as the JASS or Lua `scriptMode` in `wurst.build` and avoid providing a second value for the same setting as a compiler flag. Use ordinary `-` flags when typing options directly on the command line.

See the [compiler option definitions](https://github.com/wurstscript/WurstScript/blob/master/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/RunArgs.java) for the full list and flags that require a value. The [Lua hot reload guide]({% link _news/lua-hot-reload.md %}) explains the shared arguments and optimization limits for Hot run.

## Hello Wurst

Open the **Hello.wurst** file inside the **wurst** folder.
Expand Down
2 changes: 2 additions & 0 deletions _news/lua-hot-reload.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Start a Lua map from VS Code, change a Wurst function, and save. Compatible edit

Use **WurstScript 2.1.0 or newer**, **Wurst for VS Code 0.12.32 or newer**, and a project with `scriptMode: LUA` in `wurst.build`. We verified the full workflow on Windows with Warcraft III Reforged `3.0.1.24371`. [Compiler release](https://github.com/wurstscript/WurstScript/releases/tag/v2.1.0) · [VS Code extension](https://marketplace.visualstudio.com/items?itemName=peterzeller.wurst)

Put release optimizations on `+` lines in [`wurst_run.args`]({% link _doc/wurstbeginner.md %}#compiler-arguments) so Hot run uses only shared options.

1. In the VS Code Command Palette, run **Wurst: Hot run wurstscript map** and select your map.
2. Once the single-player game is running, edit a Wurst function that the map calls during play and save the file.
3. Check the in-game hot-reload message and try the changed behavior. If you've turned off `wurst.hotReloadOnSave`, run **Wurst: Hot reload code** manually.
Expand Down