Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Local Lua Debugger support for VSCode! #671

Merged
merged 4 commits into from
Dec 8, 2023
Merged

Conversation

BenDol
Copy link
Collaborator

@BenDol BenDol commented Dec 8, 2023

(Below will be the wiki page)

Lua Debugging

Step 1 - Open & Build

Open & build your the project in VSCode (make sure you build using debug, i.e. Windows - Debug (MSVC))

Step 2 - Install Extension

Install the VSCode Local Lua Debugger extension

Step 3 - Configure Extension

Go to File > Preferences > Settings and search for Lua-local: Interpreter make sure this is set to lua5.1

Step 4 - Add launch.json Configuration

Add the following configuration to your otclient/.vscode/launch.json configuration file (if it doesn't exist create it and paste all of the below into it. Otherwise add just the contents of "configurations": [ as a new configuration).

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lua-local",
            "request": "launch",
            "name": "Debug Lua Executable",
            "program": {
                "command": "${workspaceFolder}/otclient.exe"
            },
            "args": [
                "${workspaceFolder}"
            ],
            "scriptRoots": [
                "${workspaceFolder}/modules",
                "${workspaceFolder}/mods"
            ],
            "scriptFiles": [
                "${workspaceFolder}/modules/**/*.lua",
                "${workspaceFolder}/mods/**/*.lua"
            ],
        }
    ]
}

Step 5 - Launch in debug

Launch the new launch configuration Debug Lua Executable

image

Step 6 - Start debugging!

Now you can add breakpoints to your lua code directly and profit.
lua-debug

@BenDol BenDol changed the title Added support Local Lua Debugger VSCode Extension to debug lua directly Added Local Lua Debugger support for VSCode! Dec 8, 2023
@conde2 conde2 merged commit e9ab654 into mehah:main Dec 8, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants