在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
function getArgs(fun) local args = {} local hook = debug.gethook() local argHook = function(...) local info = debug.getinfo(3) for k,v in pairs(info) do print(k,v) end if "pcall" ~= info.name then return end for i = 1, math.huge do local name, value = debug.getlocal(2, i) print(i, name, value) if "(*temporary)" == name then debug.sethook(hook) error("") return end table.insert(args, name) end end debug.sethook(argHook, "c") pcall(fun) return args end function test(a, b, c) print(a,b,c) end local t = getArgs(test) for k,v in pairs(t) do print(k,v) end
|
请发表评论