Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>you can do stuff like this with the debug library... something like this does what you seem to be looking for:</p> <pre><code>function a_func(arg1, asdf) -- if this function doesn't use an argument... it shows up as (*temporary) in -- calls to debug.getlocal() because they aren't used... if arg1 == "10" then end if asdf == 99 then end -- does stuff with arg1 and asdf? end -- just a function to dump variables in a user-readable format function myUnpack(tbl) if type(tbl) ~= "table" then return "" end local ret = "" for k,v in pairs(tbl) do if tostring(v) ~= "" then ret = ret.. tostring(k).. "=".. tostring(v).. ", " end end return string.gsub(ret, ", $", "") end function hook() -- passing 2 to to debug.getinfo means 'give me info on the function that spawned -- this call to this function'. level 1 is the C function that called the hook. local info = debug.getinfo(2) if info ~= nil and info.what == "Lua" then local i, variables = 1, {""} -- now run through all the local variables at this level of the lua stack while true do local name, value = debug.getlocal(2, i) if name == nil then break end -- this just skips unused variables if name ~= "(*temporary)" then variables[tostring(name)] = value end i = i + 1 end -- this is what dumps info about a function thats been called print((info.name or "unknown").. "(".. myUnpack(variables).. ")") end end -- tell the debug library to call lua function 'hook 'every time a function call -- is made... debug.sethook(hook, "c") -- call a function to try it out... a_func("some string", 2012) </code></pre> <p>this results in the output:</p> <pre><code>a_func(asdf=2012, arg1=some string) </code></pre> <p>you can do fancier stuff to pretty this up, but this basically covers how to do what you're asking.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload