Module devel

Development utilities.

Functions

log(msg) Logs a message.
pp(v) “Pretty prints” a value.
stop() Sends SIGSTOP to the MC process.
view(v) “Pretty prints” a value into the viewer.


Functions

log(msg)

Logs a message.

This only works if the environment variable MC_LUA_LOG_FILE contains a path of a file you want to serve as the log file. Otherwise, this function does nothing.

The output to the log file isn’t buffered: it will be written out immediately.

Example:

ui.Panel.bind('<<load>>', function(pnl)
  devel.log('the folder ' .. pnl.dir .. ' has been read.')
end)
pp(v)
“Pretty prints” a value. It doesn’t actually do any printing: it returns a string.

This function can handle complex structures: circular references in tables are supported.

Example:

devel.log( devel.pp(fs) )

See also devel.view, which you'll more often use.

stop()
Sends SIGSTOP to the MC process.

This causes a debugger (e.g., GDB) to kick in. This lets you examine the C stack trace and variables to understand why some Lua code was called.

Additionally, before the signal is sent, the Lua stack trace is printed out using log.

This is intended for MC’s core C developers. Others will find no use for this function.

If no debugger is running, MC will just seem to hang. do kill -SIGCONT {pid} to resume the process.

view(v)
“Pretty prints” a value into the viewer.

Example:

keymap.bind('C-y', function()
  devel.view(_G)
end)

If the UI is not ready, the output will be written to stdout.

generated by LDoc 1.4.3 Last updated 2016-08-23 17:29:40