Module:DebugUtil/doc

Lua metamodule containing functions useful for debugging.

log (frame)
Logs a message to the Lua console. This is the only function in this module that should be called from templates instead of Lua code Example:

timed (f)
Returns a wrapper of  that logs the time taken in seconds for each invocation of   to the Lua console.

cargo_counted (f)
Returns a wrapper of  that logs the number of calls to   inside each invocation of   to the Lua console.

dumpObject (object)
Same as, except the returned string contains no line breaks or indentations. Serializes  to a human-readable representation, then returns the resulting string.

equal (x, y)
Compares if  and   have the same type and compare equal. Recursively calls itself for nested tables; does not support tables with self references. Ignores all metamethods.

preprocessWithUnsaved(str,p,title)
Preprocess wikitext in the debug console, but with unsaved modifications to the current module as well. Intended to be like frame:preprocess. Example usage: Notes on limitations:
 * Only able to preprocess a simple module invocation in the string currently. Breaks on multiple invocations (e.g. " ") or more wikitext surrounding the invocation.
 * The optional  parameter only sets the title associated with the frame. The context title for functions such as   will still be the current module the debug console is run on.
 * External modules that call the current module will still use the current saved version.