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

Configuration Question, trying to debug lua in DCS #60

Open
lienbacher opened this issue Apr 2, 2022 · 2 comments
Open

Configuration Question, trying to debug lua in DCS #60

lienbacher opened this issue Apr 2, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@lienbacher
Copy link

I am trying to debug lua in dcs. I have been successfully debuggin it using Lua Debugger by devCAT but I wanted to try another one for comparison. I try to configure it for using pipe, but it still seems to fail trying to find stdout, which seems to not be available in dcs. Is my configuration for using pipe incorrect maybe?

I configure it via launch.json:

        {
            "type": "lua-local",
            "request": "launch",
            "name": "Debug Tom Blind",
            "program.communication": "pipe",
            "program": {
                "command": "C:\\Program Files\\Eagle Dynamics\\DCS World OpenBeta\\bin\\DCS.exe",
            },
            "args": [
                "--server",
                "--norender",
                "-w DCS.openbeta",
            ],
            "cwd": "C:\\Program Files\\Eagle Dynamics\\DCS World OpenBeta\\bin",
        },

I hook it into DCS with this:

if os.getenv("LOCAL_LUA_DEBUGGER_VSCODE") == "1" then
    env.info("lldebugger available")
    require("lldebugger").start()
else
    env.info("lldebugger NOT available!")
end

it fails with the following log:

2022-04-02 10:25:14.178 INFO    SCRIPTING: lldebugger available
2022-04-02 10:25:14.181 ERROR   SCRIPTING: Mission script error: [string "c:\Users\deadbeef\.vscode\extensions\tomblind.local-lua-debugger-vscode-0.3.2/debugger/lldebugger.lua"]:1754: attempt to index field 'stdout' (a nil value)
stack traceback:
	[C]: ?
	[string "c:\Users\deadbeef\.vscode\extensions\tomblind.local-lua-debugger-vscode-0.3.2/debugger/lldebugger.lua"]:1754: in function 'module'
	[string "c:\Users\deadbeef\.vscode\extensions\tomblind.local-lua-debugger-vscode-0.3.2/debugger/lldebugger.lua"]:11: in function <[string "c:\Users\deadbeef\.vscode\extensions\tomblind.local-lua-debugger-vscode-0.3.2/debugger/lldebugger.lua"]:5>
	(tail call): ?
	[C]: in function 'require'
	[string "C:\Users\deadbeef\Saved Games\DCS.TKO\Missions\TKO\scripts\main.lua"]:5: in main chunk
	[C]: in function 'require'
	[string "-- set path..."]:14: in main chunk
@tomblind
Copy link
Owner

tomblind commented Apr 3, 2022

I think the way I documented this might be confusing. To switch to pipe mode, your launch.json needs to look like this:

    ...
    "program": {
        "communication": "pipe",
        "command": "C:\\Program Files\\Eagle Dynamics\\DCS World OpenBeta\\bin\\DCS.exe",
    },
    ...

@tomblind
Copy link
Owner

tomblind commented Apr 3, 2022

Looking at the error you posted, though, I think you will still run into problems. I don't currently account for the possibility that io.stdout doesn't exist at all. I'll add a check for this in the next version.

@tomblind tomblind added the bug Something isn't working label Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants