R

=== help raise() ==================================

Syntax: raise (code [, STR message [, value]])   => none

Raises <code> as an error in the same way as other MOO expressions, statements, and functions do. <Message>, which defaults to the value `tostr(<code>)', and <value>, which defaults to zero, are made available to any `try-except' statements to catch the error. If the error is not caught, then <Message> will appear on the first line of the traceback printed to the user.

=== help random() ================================

Syntax:	random (num <mod>)   => num

<mod> must be a positive number; otherwise, `E_INVARG' is returned. A number is chosen randomly from the range `[1..<mod>]' and returned.

=== help read() ==================================

Syntax:	read ([obj <player>])   => str

This function suspends the current task, waiting for a line of input from the given <player> (which defaults to the player that typed the command that initiated the current task), and resumes when such a line is received, returning that line as a string. Upon resumption, the task is given a full quota of ticks and seconds. `Read()' may only be called by a wizard, and, unless <player> is given explicitly, only in a command task that has never been suspended by a call to `suspend()'. Otherwise, `E_PERM' is returned. If the given `player' is not currently connected and has no pending lines of input, `read()' returns `E_INVARG'.

These restrictions on the use of `read()' without an explicit argument preserve the following simple invariant: if input is being read from a player, it is for the task started by the last command that player typed. This invariant adds responsibility to the programmer, however.
If your program calls another verb before doing a `read()', then that verb must also not suspend. As an example, consider the following, which refers to the verbs programmed in the `suspend()' example in `help suspend()':

    .program   #0:read_twice_A
    s = read();        /* success depends on programmer's permissions */
    #0:callee_A();     /* callee_A does not suspend */
    t = read();        /* success depends on programmer's permissions */
    .

    .program   #0:read_twice_B
    s = read();        /* success depends on programmer's permissions */
    #0:callee_B();     /* callee_B does suspend */
    t = read();        /* fails, returning E_PERM */
. In three of the four calls to `read()', success depends on on the programmer's permissions. However, the second `read()' in `#0:read_twice_B' always fails and returns `E_PERM'. This is because the task was suspended, even though `#0:read_twice_B' did not do the actual suspending. Hence, if you want to read some input (by using `read()' directly or by calling other verbs which do the reading), you must make sure that the task is not suspended before the reading. This includes making sure that any verbs you call, directly or indirectly, also do not suspend.

It is possible to call `read()' many times in the same command task, so long as the task does not call `suspend()' or an explicit argument is given. The best use for `read()' with an explicit argument is in conjunction with `open_network_connection()', if it is enabled.

=== help recycle() ================================

Syntax: recycle (obj <object>)   => none

The given <object> is destroyed, irrevocably. The programmer must either own <object> or be a wizard; otherwise, `E_PERM' is returned. If <object> is not valid, then `E_INVARG' is returned. The children of <object> are reparented to the parent of <object>. Before <object> is recycled, each object in its contents is moved to `#-1' (implying a call to <object>'s `exitfunc' verb, if any) and then <object>'s `recycle' verb, if any, is called with no arguments.

After <object> is recycled, if the owner of the former object has a property named `ownership_quota' and the value of that property is a number, then `recycle()' treats that value as a "quota" and increments it by one, storing the result back into the `ownership_quota' property.

=== help renumber() ==============================

Syntax: renumber (obj <object>)   => obj

The object number of the object currently numbered <object> is changed to be the least nonnegative object number not currently in use and the new object number is returned.
If <object> is not valid, then `E_INVARG' is returned.
If the programmer is not a wizard, then `E_PERM' is returned.
If there are no unused nonnegative object numbers less than <object>, then <object> is returned and no changes take place.

The references to <object> in the parent/children and location/contents hierarchies are updated to use the new object number, and any verbs, properties and/or objects owned by <object> are also changed to be owned by the new object number. The latter operation can be quite time consuming if the database is large. No other changes to the database are performed; in particular, no object references in property values or verb code are updated.

This operation is intended for use in making new versions of the LambdaCore database from the then-current LambdaMOO database, and other similar situations. Its use requires great care.

=== help reset_max_object() ========================

Syntax: reset_max_object ()   => none

The server's idea of the highest object number ever used is changed to be the highest object number of a currently-existing object, thus allowing reuse of any higher numbers that refer to now-recycled objects. If the programmer is not a wizard, then `E_PERM' is returned. This operation is intended for use in making new versions of the LambdaCore database from the then-current LambdaMOO database, and other similar situations. Its use requires great care.

=== help resume() ================================

Syntax: resume (INT task-id [, value])   => none

Immediately ends the suspension of the suspended task with the given <task-id>; that task's call to `suspend()' will return <value>, which defaults to zero. `Resume()' raises E_INVARG if <task-id> does not specify an existing suspended task and E_PERM if the programmer is neither a wizard nor the owner of the specified task.

=== help rindex() =================================

Syntax: index (str <str1>, str <str2> [, <case-matters>])   => num
        index (str <str1>, str <str2> [, <case-matters>])   => num

The function `index()' (`rindex()') returns the index of the first character of the first (last) occurrence of <str2> in <str1>, or zero if <str2> does not occur in <str1> at all. By default the search for an occurrence of <str2> is done while ignoring the upper/lower case distinction. If <case-matters> is provided and true, then case is treated as significant in all comparisons.
    index("foobar", "o")       	 	=>   2
    rindex("foobar", "o")       	=>   3
    index("foobar", "x")        	=>   0
    index("foobar", "oba")      	=>   3
    index("Foobar", "foo", 1)   	=>   0

=== help rmatch() =================================

Syntax:	match (str <subject>, str <pattern> [, <case-matters>])   => list
  	rmatch (str <subject>, str <pattern> [, <case-matters>])  => list

The function `match()' (`rmatch()') searches for the first (last) occurrence of the regular expression <pattern> in the string <subject>.
If <pattern> is syntactically malformed, then `E_INVARG' is returned.
If no match is found, the empty list is returned; otherwise, these functions return a list containing information about the match (see below). By default, the search ignores upper/lower case distinctions.
If <case-matters> is provided and true, then case is treated as significant in all comparisons.

The list that `match()' (`rmatch()') returns contains the details about the match made. The list is in the form:

     {<start>, <end>, <replacements>, <subject>}
where <start> is the index in STRING of the beginning of the match, <end> is the index of the end of the match, <replacements> is a list described below, and <subject> is the same string that was given as the first argument to the `match()' or `rmatch()'.

The <replacements> list is always nine items long, each item itself being a list of two numbers, the start and end indices in <subject> matched by some parenthesized sub-pattern of <pattern>. The first item in <replacements> carries the indices for the first parenthesized sub-pattern, the second item carries those for the second sub-pattern, and so on.
If there are fewer than nine parenthesized sub-patterns in <pattern>, or if some sub-pattern was not used in the match, then the corresponding item in <replacements> is the list {0, -1}. See the discussion of `%)' in `help regular-expressions', for more information on parenthesized sub-patterns.

   match("foo", "f*o")          	=>  {1, 2, {{0, -1}, ...}, "foo"}
   match("foo", "fo*")          	=>  {1, 3, {{0, -1}, ...}, "foo"}
   match("foobar", "o*b")       	=>  {2, 4, {{0, -1}, ...}, "foobar"}
   rmatch("foobar", "o*b")      	=>  {4, 4, {{0, -1}, ...}, "foobar"}
   match("foobar", "f%(o*%)b")  	=>  {1, 4, {{2, 3}, {0, -1}, ...}, "foobar"}
See `help regular-expressions' for information on the syntax and semantics of patterns.

S

=== help seconds_left() ============================

Syntax: ticks_left ()     => num
       	seconds_left ()   => num

These two functions return the number of ticks or seconds (respectively) left to the current task before it will be forcibly terminated. These are useful, for example, in deciding when to fork another task to continue a long-lived computation.

=== help server_log() ==============================

Syntax: server_log (str <message> [, <is-error>])  => none

The text in <message> is sent to the server log. If the programmer is not a wizard, then `E_PERM' is returned. If <is-error> is provided and true, then <message> is marked in the server log as an error.

=== help server_version() ===========================

Syntax: server_version ()   => str

Returns a string giving the version number of the MOO server in the following format:
    "<major>.<minor>.<release>"
where <major>, <minor>, and <release> are all decimal numbers.

The major version number changes very slowly, only when existing MOO code might stop working, due to an incompatible change in the syntax or semantics of the programming language, or when an incompatible change is made to the database format.

The minor version number changes more quickly, whenever an upward-compatible change is made in the programming language syntax or semantics. The most common cause of this is the addition of a new kind of expression, statement, or built-in function.

The release version number changes as frequently as bugs are fixed in the server code. Changes in the release number indicate changes that should only be visible to users as bug fixes, if at all.

=== help set_player_flag() ===========================

Syntax: set_player_flag (obj <object>, <value>)   => none

Confers or removes the ``player object'' status of the given <object>, depending upon the truth value of <value>.
If <object> is not valid, `E_INVARG' is returned. If the programmer is not a wizard, then `E_PERM' is returned.

If <value> is true, then <object> gains (or keeps) ``player object'' status: it will be an element of the list returned by `players()', the expression `is_player(<object>)' will return true, and users can connect to <object> by name when they log into the server.

If <value> is false, the <object> loses (or continues to lack) ``player object'' status: it will not be an element of the list returned by `players()', the expression `is_player(<object>)' will return false, and users cannot connect to <object> by name when they log into the server. In addition, if a user is connected to <object> at the time that it loses ``player object'' status, then that connection is immediately broken, just as if `boot_player(<object>)' had been called (see the description of `boot_player()' below).

=== help set_property_info() =========================

Syntax: property_info (obj <object>, str <prop-name>)   => list
    	set_property_info (obj <object>, str <prop-name>, list <info>)   => none

These two functions get and set (respectively) the owner and permission bits for the property named <prop-name> on the given <object>. If <object> is not valid, then `E_INVARG' is returned.
If <object> has no non-built-in property named <prop-name>, then `E_PROPNF' is returned. If the programmer does not have read (write) permission on the property in question, then `property_info()' (`set_property_info()') returns `E_PERM'. Property info has the following form:
    {<owner>, <perms>}
where <owner> is an object and <perms> is a string containing only characters from the set `r', `w', and `c'. This is the kind of value returned by `property_info()' and expected as the third argument to `set_property_info()'; the latter function returns `E_INVARG' if <owner> is not valid or <perms> contains any illegal characters.

=== help set_task_perms() ==========================

Syntax: set_task_perms (obj <player>)   => none

Changes the permissions with which the currently-executing verb is running to be those of <player>.
If <player> is not a valid player object, then `E_INVARG' is returned. If the programmer is neither <player> nor a wizard, then `E_PERM' is returned.

Note: This does not change the owner of the currently-running verb, only the permissions of this particular invocation. It is used in verbs owned by wizards to make themselves run with lesser (usually non-wizard) permissions.

=== help set_verb_args() ===========================

Syntax: verb_args (obj <object>, str <verb-name>)   => list
     	set_verb_args (obj <object>, str <verb-name>, list <args>)   => none

These two functions get and set (respectively) the direct-object, preposition, and indirect-object specifications for the verb named <verb-name> on the given <object>.
If <object> is not valid, then `E_INVARG' is returned.
If <object> does not define a verb named <verb-name>, then `E_VERBNF' is returned.
If the programmer does not have read (write) permission on the verb in question, then `verb_args()' (`set_verb_args()') returns `E_PERM'. Verb args specifications have the following form:
    {<dobj>, <prep>, <iobj>}
where <dobj> and <iobj> are strings drawn from the set `"this"', `"none"', and `"any"', and <prep> is a string that is either `"none"', `"any"', or one of the prepositional phrases listed much earlier in the description of verbs in the first chapter. This is the kind of value returned by `verb_info()' and expected as the third argument to `set_verb_info()'. Note that for `set_verb_args()', <prep> must be only one of the prepositional phrases, not (as is shown in that table) a set of such phrases separated by `/' characters. `Set_verb_args()' returns `E_INVARG' if any of the <dobj>, <prep>, or <iobj> strings is illegal.
    verb_args($container, "take")
                        =>   {"any", "out of/from inside/from", "this"}
    set_verb_args($container, "take", {"any", "from", "this"})

=== help set_verb_code() ===========================

Syntax: verb_code (obj <object>, str <verb-name> [, <fully-paren> [,<indent>]])   => list
   	set_verb_code (obj <object>, str <verb-name>, list <code>)   => list

These functions get and set (respectively) the MOO-code program associated with the verb named <verb-name> on <object>. The program is represented as a list of strings, one for each line of the program; this is the kind of value returned by `verb_code()' and expected as the third argument to `set_verb_code()'. For `verb_code()', the expressions in the returned code are usually written with the minimum-necessary parenthesization; if <full-paren> is true, then all expressions are fully parenthesized. Also for `verb_code()', the lines in the returned code are usually not indented at all; if <indent> is true, each line is indented to better show the nesting of statements.

If <object> is not valid, then `E_INVARG' is returned. If <object> does not define a verb named <verb-name>, then `E_VERBNF' is returned.
If the programmer does not have read (write) permission on the verb in question, then `verb_code()' (`set_verb_code()') returns `E_PERM'.
If the programmer is not, in fact, a programmer, then `E_PERM' is returned.

For `set_verb_code()', the result is a list of strings, the error messages generated by the MOO-code compiler during processing of <code>. If the list is non-empty, then `set_verb_code()' did not install <code>; the program associated with the verb in question is unchanged.

=== help set_verb_info() ===========================

Syntax: verb_info (obj <object>, str <verb-name>)   => list
     	set_verb_info (obj <object>, str <verb-name>, list <info>)   => none

These two functions get and set (respectively) the owner, permission bits, and name(s) for the verb named <verb-name> on the given <object>. If <object> is not valid, then `E_INVARG' is returned.
If <object> does not define a verb named <verb-name>, then `E_VERBNF' is returned. If the programmer does not have read (write) permission on the verb in question, then `verb_info()' (`set_verb_info()') returns `E_PERM'. Verb info has the following form:
    {<owner>, <perms>, <names>}
where <owner> is an object, <perms> is a string containing only characters from the set `r', `w', `x', and `d', and <names> is a string. This is the kind of value returned by `verb_info()' and expected as the third argument to `set_verb_info()'; the latter function returns `E_INVARG' if <owner> is not valid or <perms> contains any illegal characters.

=== help setadd() =================================

Syntax: setadd (list <list>, <value>)   => list
      	setremove (list <list>, <value>)   => list

Returns a copy of <list> with the given <value> added or removed, as appropriate. `setadd()' only adds <value> if it is not already an element of <list>; <list> is thus treated as a mathematical set. <value> is added at the end of the resulting list, if at all. Similarly, `setremove()' returns a list identical to <list> if <value> is not an element.
If <value> appears more than once in <list>, only the first occurrence is removed in the returned copy.
    setadd({1, 2, 3}, 3)         	=>   {1, 2, 3}
    setadd({1, 2, 3}, 4)         	=>   {1, 2, 3, 4}
    setremove({1, 2, 3}, 3)      	=>   {1, 2}
    setremove({1, 2, 3}, 4)      	=>   {1, 2, 3}
    setremove({1, 2, 3, 2}, 2)   	=>   {1, 3, 2}

=== help setremove() ==============================

Syntax: setadd (list <list>, <value>)   => list
      	setremove (list <list>, <value>)   => list

Returns a copy of <list> with the given <value> added or removed, as appropriate. `setadd()' only adds <value> if it is not already an element of <list>; <list> is thus treated as a mathematical set. <value> is added at the end of the resulting list, if at all. Similarly, `setremove()' returns a list identical to <list> if <value> is not an element.
If <value> appears more than once in <list>, only the first occurrence is removed in the returned copy.
    setadd({1, 2, 3}, 3)         	=>   {1, 2, 3}
    setadd({1, 2, 3}, 4)         	=>   {1, 2, 3, 4}
    setremove({1, 2, 3}, 3)      	=>   {1, 2}
    setremove({1, 2, 3}, 4)      	=>   {1, 2, 3}
    setremove({1, 2, 3, 2}, 2)   	=>   {1, 3, 2}

=== help shutdown() ===============================

Syntax: shutdown (str <message>)   => none

Requests that the server shut itself down at its next opportunity. Before doing so, the given <message> is printed to all connected players. If the programmer is not a wizard, then `E_PERM' is returned.

=== help sin() ====================================

Syntax: cos (FLOAT x)   => FLOAT
         sin (FLOAT x)   => FLOAT
         tan (FLOAT x)   => FLOAT

Returns the cosine, sine, or tangent of <x>, respectively.

=== help sqrt() ===================================

Syntax: sqrt (num <x>)  => num

Returns the square root of <x>. If <x> is negative, then `E_INVARG' is returned.

=== help strcmp() =================================

Syntax: trcmp (str <str1>, str <str2>)   => num

Performs a case-sensitive comparison of the two argument strings. If <str1> is lexicographically less than <str2>, the `strcmp()' returns a negative number.
If the two strings are identical, `strcmp()' returns zero. Otherwise, `strcmp()' returns a positive number. The ASCII character ordering is used for the comparison.

=== help string_hash() =============================

Syntax:  binary_hash (STR bin-string)   => STR
         string_hash (STR text)         => STR

Returns a 32-character hexadecimal string encoding the result of applying the MD5 cryptographically secure hash function to the contents of the string `text' or the binary string `bin-string'. MD5, like other such functions, has the property that, if
string_hash(x) == string_hash(y)

then, almost certainly

equal(x, y)
This can be useful, for example, in certain networking applications: after sending a large piece of text across a connection, also send across the result of applying string_hash() to the text; if the destination site also applies string_hash() to the text and gets the same result, you can be quite confident that the large text has arrived unchanged.

=== help strsub() =================================

Syntax: strsub (str <subject>, str <what>, str <with> [, <case-matters>])  => str

Replaces all occurrences in <subject> of <what> with <with>, performing string substitution. The occurrences are found from left to right and all substitutions happen simultaneously. By default, occurrences of <what> are searched for while ignoring the upper/lower case distinction. If <case-matters> is provided and true, then case is treated as significant in all comparisons.
    strsub("%n is a fink.", "%n", "Fred")   	=>   "Fred is a fink."
    strsub("foobar", "OB", "b")             	=>   "fobar"
    strsub("foobar", "OB", "b", 1)          	=>   "foobar"

=== help substitute() ==============================

Syntax: substitute (str <template>, list <subs>)  => str

Performs a standard set of substitutions on the string <template>, using the information contained in <subs>, returning the resulting, transformed <template>. <subs> should be a list like those returned by `match()' or `rmatch()' when the match succeeds.

In <template>, the strings `%1' through `%9' will be replaced by the text matched by the first through ninth parenthesized sub-patterns when `match()' or `rmatch()' was called. The string `%0' in <template> will be replaced by the text matched by the pattern as a whole when `match()' or `rmatch()' was called.

     subs = match("*** Welcome to LambdaMOO!!!", "%(%w*%) to %(%w*%)");
     substitute("I thank you for your %1 here in %2.", subs)
             =>   "I thank you for your Welcome here in LambdaMOO."

=== help suspend() ================================

Syntax: suspend (num <seconds>)   => none

Suspends the current task, and resumes it after at least <seconds> seconds. When the task is resumed, it will have a full quota of ticks and seconds. This function is useful for programs that run for a long time or require a lot of ticks. If <seconds> is negative, then `E_INVARG' is returned.

In some sense, this function forks the `rest' of the executing task.
However, there is a major difference between the use of `suspend(<seconds>)' and the use of the `fork (<seconds>)'. The `fork' statement creates a new task (a "forked task") while the currently-running task still goes on to completion, but a `suspend()' suspends the currently-running task (thus making it into a "suspended task"). This difference may be best explained by the following examples, in which one verb calls another:

    .program   #0:caller_A
    #0.prop = 1;
    #0:callee_A();
    #0.prop = 2;
    .

    .program   #0:callee_A
    fork(5)
      #0.prop = 3;
    endfork
    .

    .program   #0:caller_B
    #0.prop = 1;
    #0:callee_B();
    #0.prop = 2;
    .

    .program   #0:callee_B
    suspend(5);
    #0.prop = 3;
    .
Consider `#0:caller_A', which calls `#0:callee_A'. Such a task would assign 1 to `#0.prop', call `#0:callee_A', fork a new task, return to `#0:caller_A', and assign 2 to `#0.prop', ending this task. Five seconds later, if the forked task had not been killed, then it would begin to run; it would assign 3 to `#0.prop' and then stop. So, the final value of `#0.prop' (i.e., the value after more than 5 seconds) would be 3.

Now consider `#0:caller_B', which calls `#0:callee_B' instead of `#0:callee_A'. This task would assign 1 to `#0.prop', call `#0:callee_B', and suspend. Five seconds later, if the suspended task had not been killed, then it would resume; it would assign 3 to `#0.prop', return to `#0:caller', and assign 2 to `#0.prop', ending the task. So, the final value of `#0.prop' (i.e., the value after more than 5 seconds) would be 2.

A suspended task, like a forked task, can be described by the `queued_tasks()' function and killed by the `kill_task()' function. Suspending a task does not change its task id. A task can be suspended again and again by successive calls to `suspend()'.

Once `suspend()' has been used in a particular task, then the `read()' function will always return `E_PERM' in that task. For more details, see the description of `read()' below.

T

=== help task_id() ================================

Syntax: task_id ()   => num

Returns the numeric identifier for the currently-executing task. Such numbers are randomly selected for each task and can therefore safely be used in circumstances where unpredictability is required.

=== help task_stack() ==============================

Syntax: task_stack (INT task-id [, include-line-numbers])  => LIST

Returns information like that returned by the `callers()' function, but for the suspended task with the given <task-id>; the <include-line-numbers> argument has the same meaning as in `callers()'. Raises E_INVARG if <task-id> does not specify an existing suspended task and E_PERM if the programmer is neither a wizard nor the owner of the specified task.

=== help ticks_left() ===============================

Syntax:	ticks_left ()     => num
       	seconds_left ()   => num

These two functions return the number of ticks or seconds (respectively) left to the current task before it will be forcibly terminated. These are useful, for example, in deciding when to fork another task to continue a long-lived computation.

=== help time() ==================================

Syntax: time ()   => num

Returns the current time, represented as the number of seconds that have elapsed since midnight on 1 January 1970, Greenwich Mean Time.

=== help tofloat() =================================

Syntax: tofloat (value)   => FLOAT

Converts the given MOO value into a floating-point number and returns that number. Integers and objects numbers are converted into the corresponding integral floating-point numbers. Strings are parsed as the decimal encoding of a real number which is then represented as closely as possible as a floating-point number. Errors are first converted to integers as in `toint()' and then converted as integers are. `Tofloat()' raises E_TYPE if <value> is a LIST. If <value> is a string but the string does not contain a syntactically-correct number, then `tofloat()' raises E_INVARG.
  tofloat(34)       =>  34.0
  tofloat(#34)      =>  34.0
  tofloat("34")     =>  34.0
  tofloat("34.7")   =>  34.7
  tofloat(E_TYPE)   =>  1.0

=== help toint() ==================================

Syntax: toint (<value>)   => INT
         tonum (<value>)   => INT

Converts the given MOO value into an integer and returns that integer. Floating-point numbers are rounded toward zero, truncating their fractional parts. Object numbers are converted into the equivalent integers, strings are parsed as the decimal encoding of a real number which is then converted to an integer. Errors are converted into integers obeying the same ordering (with respect to `<=' as the errors themselves.) `Toint()' raises E_TYPE if <value> is a LIST. If <value> is a string but the string does not contain a syntactically-correct number, then `toint()' returns 0.
    toint(34.7)        =>   34
    toint(-34.7)       =>   34
    toint(#34)         =>   34
    toint("34")        =>   34
    toint("34.7")      =>   34
    toint(" - 34  ")   =>  -34
    toint(E_TYPE)      =>    1

=== help toliteral() ================================

Syntax: toliteral (<value>)   => STR

Returns a string containing a MOO literal expression that, when evaluated, would be equal to <value>. If no arguments or more than one argument is given, E_ARGS is raised.
Examples:
toliteral(43)                       =>  "43"
toliteral(1.0/3.0)                  =>  "0.33333333333333"
toliteral(#17)                      =>  "#17"
toliteral(E_PERM)                   =>  "E_PERM"
toliteral({"A", "B", {"C", 123}})   =>  "{\"A\", \"B\", {\"C\", 123}}"

=== help tonum() =================================

Syntax: tonum (<value>)   => num

Converts the given MOO value into a number and returns that number. Object numbers are converted into the equivalent numbers, strings are parsed as the decimal encoding of a number, and errors are converted into numbers obeying the same ordering (with respect to `<=' as the errors themselves. `tonum()' returns `E_TYPE' if <value> is a list. If <value> is a string but the string does not contain a syntactically-correct number, then `tonum()' returns 0.
    tonum(#34)         =>   34
    tonum("34")        =>   34
    tonum(" - 34  ")   =>  -34
    tonum(E_TYPE)      =>    1

=== help toobj() ==================================

Syntax: toobj (<value>)   => obj

Converts the given MOO value into an object number and returns that object number. The conversions are very similar to those for `tonum()' except that for strings, the number *may* be preceded by `#'.
    toobj("34")       	=>   #34
    toobj("#34")      	=>   #34
    toobj("foo")      	=>   #0
    toobj({1, 2})     	-error->   E_TYPE

=== help tostr() ==================================

Syntax: tostr (<value>, ...)   => str

Converts all of the given MOO values into strings and returns the concatenation of the results.
    tostr(17)                  		=>   "17"
    tostr(#17)                 		=>   "#17"
    tostr("foo")               		=>   "foo"
    tostr({1, 2})              		=>   "{list}"
    tostr(E_PERM)              	=>   "Permission denied"
    tostr("3 + 4 = ", 3 + 4)   	=>   "3 + 4 = 7"
Note that `tostr()' does not do a good job of converting lists into strings; all lists, including the empty list, are converted into the string `"{list}"'.

=== help trunc() ==================================

Syntax: trunc (FLOAT <x>)   => FLOAT

Returns the integer obtained by truncating <x> at the decimal point, as a floating-point number. For negative <x>, this is equalavent to `ceil()'; otherwise, it is equivalent to `floor()'.

=== help typeof() =================================

Syntax: typeof (<value>)   => num

Takes any MOO value and returns a number representing the type of <value>. The result is the same as the initial value of one of these built-in variables: `NUM', `STR', `LIST', `OBJ', or `ERR'. Thus, one usually writes code like this:
    if (typeof(x) == LIST) ...

and not like this:

    if (typeof(x) == 3) ...
because the former is much more readable than the latter.

V

=== help valid() ==================================

Syntax: valid (obj <object>)   => num

Returns a non-zero number (i.e., a true value) if <object> is a valid object (one that has been created and not yet recycled) and zero (i.e., a false value) otherwise.
    valid(#0)    	=>   1
    valid(#-1)   	=>   0

=== help value_bytes() =============================

Syntax: value_bytes(<value>)   => INT

Returns the number of bytes of the server's memory required to store the given <value>.

=== help value_hash() ==============================

Syntax: value_hash (<value>)   => STR

Returns the same string as `string_hash(toliteral(<value>))'; see the description of `string_hash()' for details.

=== help verb_args() ===============================

Syntax: verb_args (obj <object>, str <verb-name>)   => list
     	set_verb_args (obj <object>, str <verb-name>, list <args>)   => none

These two functions get and set (respectively) the direct-object, preposition, and indirect-object specifications for the verb named <verb-name> on the given <object>. If <object> is not valid, then `E_INVARG' is returned. If <object> does not define a verb named <verb-name>, then `E_VERBNF' is returned.
If the programmer does not have read (write) permission on the verb in question, then `verb_args()' (`set_verb_args()') returns `E_PERM'. Verb args specifications have the following form:
    {<dobj>, <prep>, <iobj>}
where <dobj> and <iobj> are strings drawn from the set `"this"', `"none"', and `"any"', and <prep> is a string that is either `"none"', `"any"', or one of the prepositional phrases listed much earlier in the description of verbs in the first chapter. This is the kind of value returned by `verb_info()' and expected as the third argument to `set_verb_info()'. Note that for `set_verb_args()', <prep> must be only one of the prepositional phrases, not (as is shown in that table) a set of such phrases separated by `/' characters. `Set_verb_args()' returns `E_INVARG' if any of the <dobj>, <prep>, or <iobj> strings is illegal.
    verb_args($container, "take")
                        =>   {"any", "out of/from inside/from", "this"}
    set_verb_args($container, "take", {"any", "from", "this"})

=== help verb_code() ==============================

Syntax: verb_code (obj <object>, str <verb-name> [, <fully-paren> [, <indent>]])   => list
     	set_verb_code (obj <object>, str <verb-name>, list <code>)   => list

These functions get and set (respectively) the MOO-code program associated with the verb named <verb-name> on <object>. The program is represented as a list of strings, one for each line of the program; this is the kind of value returned by `verb_code()' and expected as the third argument to `set_verb_code()'. For `verb_code()', the expressions in the returned code are usually written with the minimum-necessary parenthesization; if <full-paren> is true, then all expressions are fully parenthesized. Also for `verb_code()', the lines in the returned code are usually not indented at all; if <indent> is true, each line is indented to better show the nesting of statements.

If <object> is not valid, then `E_INVARG' is returned. If <object> does not define a verb named <verb-name>, then `E_VERBNF' is returned. If the programmer does not have read (write) permission on the verb in question, then `verb_code()' (`set_verb_code()') returns `E_PERM'. If the programmer is not, in fact, a programmer, then `E_PERM' is returned.

For `set_verb_code()', the result is a list of strings, the error messages generated by the MOO-code compiler during processing of <code>.
If the list is non-empty, then `set_verb_code()' did not install <code>; the program associated with the verb in question is unchanged.

=== help verb_info() ===============================

Syntax: verb_info (obj <object>, str <verb-name>)   => list
     	set_verb_info (obj <object>, str <verb-name>, list <info>)   => none

These two functions get and set (respectively) the owner, permission bits, and name(s) for the verb named <verb-name> on the given <object>. If <object> is not valid, then `E_INVARG' is returned. If <object> does not define a verb named <verb-name>, then `E_VERBNF' is returned. If the programmer does not have read (write) permission on the verb in question, then `verb_info()' (`set_verb_info()') returns `E_PERM'. Verb info has the following form: {<owner>, <perms>, <names>} where <owner> is an object, <perms> is a string containing only characters from the set `r', `w', `x', and `d', and <names> is a string. This is the kind of value returned by `verb_info()' and expected as the third argument to `set_verb_info()'; the latter function returns `E_INVARG' if <owner> is not valid or <perms> contains any illegal characters.

=== help verbs() ==================================

Syntax: verbs (obj <object>)   => list

Returns a list of the names of the verbs defined directly on the given <object>, not inherited from its parent.
If <object> is not valid, then `E_INVARG' is returned.
If the programmer does not have read permission on <object>, then `E_PERM' is returned.