Method code for $has_commands.del_command()

[Turn off line numbering]
  1: arg template, method;
  2: var cmd, c, d, info, type;
  3: 
  4: (> .perms(sender()) <);
  5: cmd = template.explode();
  6: if (!cmd)
  7:     throw(~type, "Invalid template.");
  8: cmd = cmd[1];
  9: info = #[['local, .get_command_info('local, cmd)]];
 10: info = info.add('remote, .get_command_info('remote, cmd));
 11: for type in (info) {
 12:     for c in (type[2]) {
 13:         if (c[3] == template && c[4] == method) {
 14:             set_var(type[1], get_var(type[1]).del_elem(cmd, c));
 15:             if (type[1] == 'remote)
 16:                 $remote_cache.del_remote_command(cmd, this());
 17:             d++;
 18:         }
 19:     }
 20: }
 21: return d;

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

Tlon