MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

I love the new server...



...it's so fun to program! :b

@verb me:@function*s any none none rd
@program me:@function
"Usage: @function*s [name]";
"Returns info on the builtin function specified if any; otherwise, provides";
" info for all available builtins";
types = {"ANY", "NUM", "OBJ", "STR", "ERR", "LIST"};
try
  info = dobjstr ? {function_info(dobjstr)} | function_info();
except (E_INVARG)
  player:tell("There is no builtin function named '" + dobjstr + "'.");
  return;
endtry
for bf in (info)
  string = bf[1] + "(";
  min = bf[2];
  max = bf[3];
  arglist = bf[4];
  for i in [1..min]
    string = string + types[arglist[i] + 2] + ", ";
  endfor
  if (max == -1)
    "no max args";
    string = string + "...";
  elseif (max > min)
    string = string + "[";
    for i in [min + 1..max]
      string = string + types[arglist[i] + 2] + ", ";
    endfor
    string = string[1..($) - 2] + "]";
  elseif (max > 0)
    string = string[1..($) - 2];
  endif
  player:tell(string + ")");
endfor
.


Follow-Ups:

Home | Subject Index | Thread Index