I am tracing a Lua project
(
https://github.com/Nymphium/eff.lua) with the env - Lua 5.1, vscode
1.96.4, Debian trixie/ sid. Initially I inserted print command in the the project related code. Though it works ok, several parts which reference to
Lua table objects inside eff.lua project I do not know how to check the
encapsulated values inside those tables. The console merely prints info such as table: 0x55fce37509c0. Therefore, I appreciate if any
advice on how to debug Lua program.
{
"version": "0.2.0",
"configurations": [
{
"type": "lua",
"request": "launch",
"name": "Launch",
"program": "${workspaceFolder}/test1.lua"
}
]
}
The test1.lua is as below
local eff = require('src/eff')
local inst, perform, handler = eff.inst, eff.perform, eff.handler
local Choice = inst()
local always_right = handler {
val = function(arg) print("printh ended and args are:", arg) end,
[Choice] = function(continue_fn, left, right)
return continue_fn(right)
end
}
always_right(function()
print(perform(Choice(3, 4)) + 3)
end)
But
after placing several breakpoints and clicking Run > Start Debugging, vscode flashes and immediately
finishes as if nothing happened. And no messages - either success or
failure - are shown in Debug Console.
I can run the test1.lua by executing the command lua test1.lua within the cloned directory.
+ eff.lua (cloned dir)
- test1.lua
+ src/eff.lua
The result is something like this
Inside perform e.eff table: 0x55fce37509c0 -- I want to check what's inside e.eff, but print(e.eff) or print(e.eff[1]) or print(e.eff[2]) shows table: 0x55fce37509c0 or nil or nil
Inside handler left: 3 right: 4
7
printh ended and args are: nil
If not debugging through vscode, any recommended tutorials or steps that I should check or follow?
Many thanks