-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebugger.lua
More file actions
38 lines (31 loc) · 771 Bytes
/
Copy pathdebugger.lua
File metadata and controls
38 lines (31 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
local IS_DEBUG = os.getenv("LOCAL_LUA_DEBUGGER_VSCODE") == "1" and arg[2] == "debug"
if IS_DEBUG then
print("Starting debugger...")
lldebugger = require("lldebugger")
lldebugger.start()
function love.errorhandler(msg)
error(msg, 2)
end
end
local function getArgs(func)
local info = debug.getinfo(func, "u")
local params = {}
if info and info.nparams then
for i = 1, info.nparams do
local paramName = debug.getlocal(func, i)
table.insert(params, paramName)
end
end
return params
end
local function print_table(table)
for key, value in pairs(table) do
print(key, value)
end
end
local debug =
{
getArgs = getArgs,
print_table = print_table
}
return debug