View/Edit #29:to_value

Switch to edit mode.

Name(s): to_value
1:  ":to_value(string) tries to parse string as a value (i.e., object, number, string, error, or list thereof).  Opposite of toliteral()"
2:  "Returns {1,value} or {0,error_message} according as the attempt was successful or not."
3:  "Eg. :to_value(\"{1, #2, \\\"three\\\"}\") => {1, {1, #2, \"three\"}}"
4:  set_task_perms($no_one)
5:  "Following clause added to allow matching for the '~player' format..."
6:  "Following clause removed due to web errors. A url of http://www/~user/whee.html was changes to include a #-3. ;) Commented, will make a work around if anyone notices a change in usability. - Lao (Oct 11, '99)"
7:  "if (args[1][1] == \"{\")"
8:  "  while (i = index(args[1], \"~\"))"
9:  "    j = ((index(args[1][i..$], \",\") || index(args[1][i..$], \"}\")) + i) - 1;"
10: "    name = $string_utils:trim(args[1][i + 1..j - 1]);"
11: "    args[1][i..j - 1] = tostr($string_utils:match_player(name));"
12: "  endwhile"
13: "endif"
14: try
15:   return eval("Return " + args[1] + ";")
16: except error (ANY)
17:   return {0, error[1]}
18: endtry
19: "Last modified by Lao-Tzu (#8084) on Mon Oct 11 14:07:50 1999 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Dax (#789)

You are not logged in.

[home | help | who | search | setup | code]