API debuglocals

Returns a string dump of all local variables and upvalues at a given stack level.
 locals = debuglocals([level])
==Arguments==
:;level: - The stack level to inspect. Defaults to 1 (the calling function).
==Returns==
:;locals: - A string dump of all local variables, temporaries, and upvalues.
==Details==
* This function will return no values if called outside of the execution of the global error handler function.
==Example==
The following snippet demonstrates example output for a variety of values. Note that this snippet may not work as-is if you have an error handling addon installed, as these typically hijack and replace the ability to change the global error handler.
local Upvalue = "banana"
seterrorhandler(function()
 local Number = 1.23456
 local String = "foo"
 local NamedFrame = { [0] = ChatFrame1[0] }
 local Table = {
 1,
 2,
 foo = "bar",
 {
 "debuglocals should only inspect at-most one level of tables; this shouldn't be printed",
 },
 }
 local Thread = coroutine.create(function() end)
 local Boolean = true
 local Nil = nil
 local Temp = Upvalue
 print(debuglocals())
end)
error("")
Number = 1.234560
String = "foo"
NamedFrame = ChatFrame1 {
 0 = <userdata>
}
Table = <table> {
 1 = 1
 2 = 2
 3 = <table> {
 }
 foo = "bar"
}
Thread = <no value>
Boolean = true
Nil = nil
Temp = "banana"
(*temporary) = <function> defined @Interface\FrameXML\UIParent.lua:5234
Upvalue = "banana"
==Patch changes==