Noita VSCode Debugger is a mod for Noita that allows you to debug your Lua code using VSCode.
BUT unfortunately you cannot debug Noita Lua Components, because necessary functions are not available in that Lua context.
C:\Program Files (x86)\Steam\steamapps\common\Noita\mods\
and extract it there. need help?launch.json
file: launch.json"cwd"
needs to be changed to Noita installation path. need help?F5
to start debugging.noita-vscode-debugger
mod is enabled in the mod list\
and above any other mod that you want to debug.Start a new game with enabled mods active
\
or click on Continue
if you already have a save file with the mod enabled\
or finally click on New Game
.Didn't work? Take a look on In case of issues.
Need help with the debugger itself? Go ahead!
Need help reading the logs? Go ahead!\
I am using powershell
:
cd 'C:\Program Files (x86)\Steam\steamapps\common\Noita'; Get-Content -Path "logger.txt" -Wait
First delete noita-vscode-debugger
mod from C:\Program Files (x86)\Steam\steamapps\common\Noita\mods\
and download the latest release.
Second make sure\
"args": ["-debug_lua", "-no-console", "-luadebugger"],
and\
"pullBreakpointsSupport": true,
\
are set in .vscode/launch.json
\
You can copy and paste launch.json from this repository, BUT make sure to change noita-vscode-debugger
to your own mod name / mod string id. CTRL+R
is the key.
Open windows file explorer with\
%USERPROFILE%/.vscode/extensions/ismoh.local-lua-debugger-vscode-0.3.3/debugger/
\
and remove the first line of lldebugger.lua
, which is
--_VERSION = "v0.3.3-IsmohFixes"
After that rerun Noita with enabled noita-vscode-debugger
and take a look for the following in logs:
Successfully fixed package.path and package.cpath!\ Successfully applied all fixes!\ Happy debugging!
Disable noita-vscode-debugger
mod in Noita.
Then the fun part begins!\
You only need to run noita-vscode-debugger
once, to apply all fixes.\
After that you need to make sure the debugger is able to be initialized correctly and is able to pull breakpoints
launch.json
property args "-luadebugger"
.\
But you only want the debugger to be available, when debugging:
This is why, you should add the following snippet in your own mod init.lua
if not lldebugger then
-- lldebugger is not initialized, so mock functions to avoid errors
lldebugger = {} -- or _G.lldebugger = {}
lldebugger.pullBreakpoints = function() end
print("Debugger disabled, because Noita wasn't started from VSCode!")
else
-- lldebugger is only initialized, when starting Noita with VSCode debugger
-- by adding the following to launch.json: "args": ["-luadebugger"]
lldebugger.start(true)
print("Debugger initialized! YAY! Happy debugging!")
end
init.lua
.\
Use any of Noitas [A-Z][a-z]{Pre|Post}Update()
functions, to make sure the breakpoints are pulled on runtime:\
OnPausePreUpdate
and/or OnPausePreUpdate
and/or OnPausePostUpdate
and/or OnWorldPostUpdate
:function OnWorldPreUpdate()
--if lldebugger then
lldebugger.pullBreakpoints()
--end
end
Still no luck?\ Go ahead to Discord forum!