DEV Community

Yago Crispim Rodrigues Souza
Yago Crispim Rodrigues Souza

Posted on

1 1 1 1 1

Debugging Lua with LuaRocks packages in VSCode

Debugging using "print" is okay, but it's not productive or efficient. This is why I like to use the debugger.

But, when I install packages using LuaRocks the debugger can't find the path to the "lua_modules" folder.

If you also have this problem, you can add the code below to the first line of your main file.

local LUA_PATH = 'my LUA_PATH from "$ luarocks path"'
local LUA_CPATH = 'my LUA_CPATH from "$ luarocks path"'

package.path = package.path .. ';' .. LUA_PATH
package.cpath = package.cpath .. ';' .. LUA_CPATH
Enter fullscreen mode Exit fullscreen mode

I hope you found this post helpful.
If you have any questions, please feel free to leave a comment.

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post