debugging-mods
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
debugging-mods [2021/10/22 10:00] – external edit 127.0.0.1 | debugging-mods [2021/10/25 13:00] (current) – maxime | ||
---|---|---|---|
Line 7: | Line 7: | ||
The first step in debugging a mod is to setup the chosen debugger in the VM. This cannot be done by the mod scripts themselves as it requires escaping the sandbox they operate in; the required setup must be placed in a special '' | The first step in debugging a mod is to setup the chosen debugger in the VM. This cannot be done by the mod scripts themselves as it requires escaping the sandbox they operate in; the required setup must be placed in a special '' | ||
- | When the game starts and creates the lua VM, all scripts in this folder are loaded without any of the restrictions imposed on regular mod files. While this allows changing the lua environment to make mod development easier (such as by inserting a debugger), it also allows potentially unsafe scripts to run. **Mods should not require files in this folder in order to run properly.** | + | When the game starts and creates the lua VM, all scripts in this folder are loaded without any of the restrictions imposed on regular mod files. While this allows changing the lua environment to make mod development easier (such as by inserting a debugger), it also allows potentially unsafe scripts to run. **Mods |
- | + | ||
- | ===== Visual Studio Code ===== | + | |
- | + | ||
- | Debugging mods in Visual Studio Code can be done with the [[https:// | + | |
- | + | ||
- | <file lua> | + | |
- | require(" | + | |
- | </ | + | |
- | + | ||
- | The extension currently does not support attaching its debugger to a running executable, but we can configure it to automatically launch the game (with the debugger attached) in the project’s launch.json | + | |
- | + | ||
- | <file json> | + | |
- | { | + | |
- | " | + | |
- | " | + | |
- | { | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | }, | + | |
- | " | + | |
- | } | + | |
- | ] | + | |
- | } | + | |
- | </ | + | |
===== ZeroBrane Studio ===== | ===== ZeroBrane Studio ===== | ||
Line 42: | Line 15: | ||
While ZeroBrane Studio includes a version of luasocket, the IDE (and the libraries it includes) is only provided in 32-bit. Thus, a 64-bit version of the DLL is provided with the Foundation installation, | While ZeroBrane Studio includes a version of luasocket, the IDE (and the libraries it includes) is only provided in 32-bit. Thus, a 64-bit version of the DLL is provided with the Foundation installation, | ||
- | <file lua> | + | < |
local zbs = "< | local zbs = "< | ||
package.path = package.path .. ";" | package.path = package.path .. ";" | ||
- | package.cpath = package.cpath .. "; | + | package.cpath = package.cpath .. "; |
require(" | require(" | ||
</ | </ |
debugging-mods.1634911248.txt.gz · Last modified: 2021/10/22 10:00 by 127.0.0.1