Method code for $code_lib.generate_listing()

[Turn on line numbering]
arg who, @args;
var meths, header, title, i;

// called by one of the who_cmds, does all the grunge work.
[(title ?= "Connected Users"), (meths ?= [['namef, 'doing], ['connected_time], ['idle_time], ['realm_name]]), (header ?= ["Name", "On for", "Idle", "Location"])] = args;
header = map i in (header) to ([i, "".pad(i.length(), "-")]);

// if who is empty, only print header
if (!who)
    return ["--- " + title + " (0) ---"];

// get values using $list.mmap and format
return ["--- %l (%l) ---".format(title, who.length()), @map i in (meths) to (who.mmap(@i)).tabulate(header, 0, 1, " ", (| sender().linelen() |) || 79), "---"];

["// Created 26-Mar-1995 as a part of ColdCore, see: @help Credit"]

the Cold Dark