Method code for $code_lib.generate_listing()

[Turn off line numbering]
  1: arg who, @args;
  2: var meths, header, title, i;
  3: 
  4: // called by one of the who_cmds, does all the grunge work.
  5: [(title ?= "Connected Users"), (meths ?= [['namef, 'doing], ['connected_time], ['idle_time], ['realm_name]]), (header ?= ["Name", "On for", "Idle", "Location"])] = args;
  6: header = map i in (header) to ([i, "".pad(i.length(), "-")]);
  7: 
  8: // if who is empty, only print header
  9: if (!who)
 10:     return ["--- " + title + " (0) ---"];
 11: 
 12: // get values using $list.mmap and format
 13: return ["--- %l (%l) ---".format(title, who.length()), @map i in (meths) to (who.mmap(@i)).tabulate(header, 0, 1, " ", (| sender().linelen() |) || 79), "---"];

// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit

Tlon