local-lua-debugger-vscode icon indicating copy to clipboard operation
local-lua-debugger-vscode copied to clipboard

Allowing inspection of functions

Open sewbacca opened this issue 2 years ago • 0 comments

This pull request allows you to inspect variables inside a closure, as I mentioned in #70. I am using debug metatables for functions to allow further inspection. Currently it is looking up all upvalues, once it is indexed by the property name. It is usefull when having a lot of closures flying arround, e.g.


local function wrap(name)
    return function() return name end
end

local a = wrap "a"
local b = wrap "b"

local function callAndPrint(f)
    return print(f()) -- Which f?
end

callAndPrint(a)
callAndPrint(b)

Since, the change itself is small, but the impact could be big, I would recommend reviewing the code before merging. I am not too familiar with this project.

sewbacca avatar Oct 05 '22 14:10 sewbacca