DEV Community

Yago Crispim Rodrigues Souza
Yago Crispim Rodrigues Souza

Posted on

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)