Method code for $root.add_method()

[Turn off line numbering]
  1: arg code, name, @evalonly;
  2: var l, m, line, errs;
  3: 
  4: (> .perms(sender()) <);
  5: if (evalonly && caller() in [$root, $sys, $programmer])
  6:     (> $sys.touch('lockok) <);
  7: else
  8:     (> $sys.touch() <);
  9: 
 10: // check for a few things only admins can do
 11: if (!sender().is($admin)) {
 12:     for l in [1 .. listlen(code)] {
 13:         line = code[l];
 14:         if ((m = line.match_regexp("[^a-z0-9_.]anticipate_assignment\("))) {
 15:             (> sender().tell($code_lib.point_to_line("ERROR: call to anticipate_assignment()", m[1][1] + 2, m[1][2] - 2, l, line)) <);
 16:             throw(~perm, "anticipate_assignment() may only be used by an administrator.");
 17:         }
 18:     }
 19: }
 20: errs = (> add_method(code, name) <);
 21: if ('core in .flags())
 22:     $changelog.log("ADD-METHOD: " + this() + "." + name + " by " + sender());
 23: for l in [1 .. listlen(errs)] {
 24:     line = errs[l];
 25:     if (match_regexp(line, "Line [0-9]+: Unknown function length.")) {
 26:         line = substr(line, 1, strlen(line) - 1);
 27:         errs = replace(errs, l, line + "(), try listlen(), strlen() or buflen()");
 28:     }
 29: }
 30: return errs;

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

the Cold Dark