lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Another debugging one here. This one takes a formatted output function
(and you can register one to act as the default) and
then applies that line-by-line. The line-by-line thing lets us dump to
arrays or other structures (e.g. a vector or linked list of
strings on the C side), which can sometimes be easier to traverse.
Also handles cycles and arbitrary keys, and respects
__tostring; it ignores metatable and environment, though maybe I'll
add those as options some day.

Example:

function printf (format, ...)
  print(string.format(format, ...))
end

var_dump.Print(MyVariable, printf) -- Accepts any value, tables are
just a special case

or

var_dump.SetDefaultOutf(printf)
var_dump.Print(MyBigTable)

License is MIT.

Attachment: VarDump.lua
Description: Binary data

Attachment: VarPreds.lua
Description: Binary data