Skip to content

Instantly share code, notes, and snippets.

@Deco
Created May 6, 2012 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Deco/2623545 to your computer and use it in GitHub Desktop.
Save Deco/2623545 to your computer and use it in GitHub Desktop.
debug.getparams
function debug.getparams(f)
local co = coroutine.create(f)
local params = {}
debug.sethook(co, function(event, line)
local i, k, v = 1, debug.getlocal(co, 2, 1)
while k do
if k ~= "(*temporary)" then
table.insert(params, k)
end
i = i+1
k, v = debug.getlocal(co, 2, i)
end
coroutine.yield()
end, "c")
local res = coroutine.resume(co)
return params
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment