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)

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay