Debugging Lua with LuaRocks packages in VSCode

yagocrispim

Yago Crispim Rodrigues Souza

Posted on November 13, 2023

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.

💖 💪 🙅 🚩
yagocrispim
Yago Crispim Rodrigues Souza

Posted on November 13, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related