Debugging facility

This is a helper to display information on object creation and destruction. Pass any information when creating the object and this information will be printed out on destruction.

The core of this class is written in C++ to use finalizers.

Class functions

.new (name, ...)

Create a new debug object with a name and some more arguments to be printed.

obj.debug = lk.Debug("an obj", obj.id, obj.type)
-- optional callback function
function obj.debug:callback()
  -- do something here
end

.inspect (elem)

Printout inspect information on a table or userdata.

.userdata (udata)

Return userdata type and pointer value.

.logExecution (prefix, hook_type)

Start logging program execution. The @hook_type@ can be 'l' (log every line), 'r' (log return from function) or 'c' (log function calls = default).

Usage:

-- start logging
lk.Debug.logExecution('trial')
testFunction()
-- stop logging
lk.Debug.logExecution('trial', false)