MongooseWhere programmers kick back and build silly things together.
Properties on #11384

Name Owner Perms Value
1 .stunt glorp rc {"LambdaMOO-Stunt adds the following built-in functions:", "", "binary_hmac", "string_hmac", "value_hmac - Cryptographically secure HMAC functions.", "decode_base64", "encode_base64 - Encode and decode binary Base64 strings.", "exec - Execute shell scripts and applications.", "exp - Return Eulers number (E) to the power of <x>.", "generate_json - Return the JSON representation of the MOO value.", "parse_json - Return the MOO value representation of a JSON string.", "getenv - Return the value of the named environment variable.", "mapdelete - Delete a key from a map.", "mapkeys - List the keys in a map.", "mapvalues - List the values in a map.", "random_bytes - Return a binary string of <x> bytes.", "read_http - Parse lines from a network connection as HTTP requests.", "salt - Generate a cryptographically secure salt string.", "strtr - Replace characters in a string.", "crypt - Encrypt a string using a variety of algorithms.", "task_local - Return values associated with the current task.", "set_task_local - Set values associated with the current task.", "respond_to - Check if a verb is callable on an object.", "isa - Check if an object is a descendant of another object.", "switch_player - Silently switch a connection to another player.", "", "", "Additionally, the ToastStunt fork adds these:", "", "argon2 - Argon2id secure hashing.", "argon2_verify - Compares password to hash", "sqlite - See HELP SQLITE for a complete list.", "pcre_match - Match a string using PCRE2 regular expressions.", "pcre_replace - Replace text in a string using PCRE2 regular expressions.", "pcre_cache_stats - Return PCRE pattern cache statistics.", "frandom - Random floats.", "round - Round a float to the nearest integer value.", "cbrt - Cube root.", "acosh", "asinh", "atanh", "atan2 - Additional inverse trigonometric functions.", "distance - Calculate the distance between an arbitrary number of points.", "relative_heading - Calculate a relative bearing between two points.", "simplex_noise - Generate Simplex Noise.", "parse_ansi", "remove_ansi - Convert or remove ToastStunt ANSI tags.", "url_encode", "url_decode - URL encode and decode strings.", "memory_usage - Total memory used, resident set size, shared pages, text, data + stack", "malloc_stats - Return jemalloc statistics when available.", "gc_stats", "run_gc - Garbage collection diagnostics when available.", "ftime - Precise time, including an argument for monotonic timing.", "locate_by_name - Quickly locate objects by their name and aliases.", "usage - Returns a list of system information from the operating system.", "explode - Return a list of substrings of a string separated by a break.", "occupants - Return a list of objects of parent parent, optionally with a player flag check.", "spellcheck - Check the spelling of a word using Aspell.", "locations - Recursive location reporting function.", "threads - Display a list of active threads.", "new_waif - Create a new waif.", "waif_stats - Display a count of instantiated waifs by class.", "sort - Sorts a list by itself or another list of keys. Also support natural ordering and reverse.", "yin - Yield if needed. Suspend a task when running out of ticks or seconds.", "slice - Makes a new list of the index-th elements of the original list.", "reverse - Reverse a list.", "recreate - Create valid objects from invalid objects.", "set_thread_mode - Enable or disable threading of functions for the current verb.", "task_perms - Return the permissions of the current task.", "anon - Debug-only anonymous object information.", "chr - Translate integers into ASCII characters.", "recycled_objects - Return a list of all invalid objects in the database.", "next_recycled_object - Return the first available invalid object.", "all_members - Return the indices of all instances of an element in a list.", "owned_objects - Return a list of all objects owned by the specified player.", "sqlite_limit - Specify limits on various SQLite constructs.", "curl - Return websites as strings.", "connection_name_lookup - Perform a DNS name lookup in another thread.", "thread_pool - Manipulate the server thread pool. (Caution advised.)", "connection_info - Return network information about a specific connection.", "maphaskey - Return true if a map contains the key specified.", "ancestors - Return all ancestors of an object", "finished_tasks - When enabled, track execution time", "listen - Updated listen() with ipv6 & tls", "listeners - Return information about active listening points.", "open_network_connection - Updated to support ipv6 & tls", "reseed_random - Provide a new seed to the pseudo random number generator.", "FileIO - See HELP fileio for details", "log_cache_stats", "verb_cache_stats", "create", "value_hash", "index", "rindex", "encode_base64", "decode_base64", "string_hash", "binary_hash", "server_log", "new_waif", "sqlite", "typeof", "reverse", "locations", "finished_tasks", "explode", "chparents", "parents", ""}
2 .sqlite glorp rc {"SQLite allows you to store information in locally hosted SQLite databases. These built-ins are available only when ToastStunt is built with SQLite support. All SQLite built-in functions require wizard permissions; otherwise E_PERM is raised.", "", "The following functions (see HELP <function name> for detailed information) are available:", "", "sqlite_open Opens an SQLite database.", "sqlite_close Closes an SQLite database.", "sqlite_handles Returns a list of open SQLite database handles.", "sqlite_info Returns information about an open SQLite database.", "sqlite_query Runs a raw SQL query on the database.", "sqlite_execute Executes an SQL prepared statement on the database.", "sqlite_limit Set limits on various SQL constructs.", "sqlite_interrupt Abort a database operation.", "sqlite_last_insert_row_id Identifies row ID of the last insert command"}
3 .fio glorp rc {"*forward*", "fileio"}
4 .fileio glorp rc {"General-purpose functions:", "", "FHANDLE file_open(STR pathname, STR mode)", "void file_close(FHANDLE fh)", "STR file_name(FHANDLE fh)", "STR file_openmode(FHANDLE fh)", "STR file_readline(FHANDLE fh)", "LIST file_readlines(FHANDLE fh, INT start, INT end)", "void file_writeline(FHANDLE fh, STR line)", "STR file_read(FHANDLE fh, INT bytes)", "INT file_write(FHANDLE fh, STR data)", "void file_flush(FHANDLE fh)", "INT file_tell(FHANDLE fh)", "void file_seek(FHANDLE fh, INT loc, STR whence)", "INT file_eof(FHANDLE fh)", "void file_rename(STR oldpath, STR newpath)", "void file_remove(STR pathname)", "void file_mkdir(STR pathname)", "void file_rmdir(STR pathname)", "LIST file_list(STR pathname, [ANY detailed])", "STR file_type(STR pathname|FHANDLE fh)", "STR file_mode(STR filename|FHANDLE fh)", "void file_chmod(STR filename, STR mode)", "LIST file_handles()", "LIST file_grep(FHANDLE fh, STR search [,?match_all=0])", "", "Attribute functions:", "", "INT file_size(STR pathname)", "STR file_mode(STR pathname)", "INT file_last_access(STR pathname)", "INT file_last_modify(STR pathname)", "INT file_last_change(STR pathname)", "INT file_size(FHANDLE fh)", "STR file_mode(FHANDLE fh)", "INT file_last_access(FHANDLE fh)", "INT file_last_modify(FHANDLE fh)", "INT file_last_change(FHANDLE fh)", "INT file_count_lines(FHANDLE fh)", "", "LIST file_stat(STR pathname)", "LIST file_stat(FHANDLE fh)", "", ""}
5 .toaststunt glorp rc {"*forward*", "stunt"}
6 .is_member() glorp rc {"Syntax: is_member (ANY value, LIST list [, INT case-sensitive]) => INT", "", "Returns the index of <value> if there is an element of <list> that is completely indistinguishable from <value>. This is much the same operation as \"<value> in <list>\" except that, unlike `in', the `is_member()' function does not treat upper- and lower-case characters in strings as equal. This treatment of strings can be controlled with the <case-sensitive> argument; setting <case-sensitive> to false will effectively disable this behavior.", "", "Raises E_ARGS if two values are given or if more than three arguments are given. Raises E_TYPE if the second argument is not a list. Otherwise returns the index of <value> in <list>, or 0 if it's not in there.", "", " is_member(3, {3, 10, 11}) => 1", " is_member(\"a\", {\"A\", \"B\", \"C\"}) => 0", " is_member(\"XyZ\", {\"XYZ\", \"xyz\", \"XyZ\"}) => 3", " is_member(\"def\", {\"ABC\", \"DEF\", \"GHI\"}, 0) => 2"}
7 .listen() glorp rc {"Syntax: listen (OBJ <object>, INT <port> [, MAP <options>]) => value", "", "Create a new point at which the server will listen for network connections, just as it does normally. <Object> is the object whose verbs `do_login_command', `do_command', `do_out_of_band_command', `user_connected', `user_created', `user_reconnected', `user_disconnected', and `user_client_disconnected' will be called at appropriate points as these verbs are called on #0 for normal connections. (See the chapter in the LambdaMOO Programmer's Manual on server assumptions about the database for the complete story on when these functions are called.) <Port> is a TCP port number on which to listen. The listen() function will return <port> unless <port> is zero, in which case the return value is a port number assigned by the operating system.", "", "An optional third argument allows you to set various miscellaneous options for the listening point. These are:", "", " print-messages: If true, the various database-configurable messages (also detailed in the chapter on server assumptions) will be printed on connections received at the new listening port.", " ipv6: Use the IPv6 protocol rather than IPv4.", " tls: Only accept valid secure TLS connections.", " certificate: The full path to a TLS certificate. NOTE: Requires the TLS option also be specified and true. This option is only necessary if the certificate differs from the one specified in options.h.", " key: The full path to a TLS private key. NOTE: Requires the TLS option also be specified and true. This option is only necessary if the key differs from the one specified in options.h.", " interface: This allows you to specify the interface to listen on. (Similar to the --ipv4 or --ipv6 command-line arguments.)", "", "Proxy rewriting is no longer enabled by default. Trusted proxy IP addresses may be listed in $server_options.trusted_proxies or in an equivalent trusted_proxies property on the listening object.", "", "listen() raises E_PERM if the programmer is not a wizard, E_INVARG if <object> is invalid or there is already a listening point described by <point>, and E_QUOTA if some network-configuration-specific error occurred.", "", "", "Example:", ">;listen(#0, 1234, [\"ipv6\" -> 1, \"tls\" -> 1, \"certificate\" -> \"/etc/certs/something.pem\", \"key\" -> \"/etc/certs/privkey.pem\", \"print-messages\" -> 1])", "Listen for IPv6 connections on port 1234 and print messages as appropriate. These connections must be TLS and will use the private key and certificate found in /etc/certs."}
8 .move() glorp rc {"Syntax: move (OBJ <what>, OBJ <where>[, INT <position>]) => none", "", "Changes <what>'s location to be <where>. This is a complex process because a number of permissions checks and notifications must be performed. The actual movement takes place as described in the following paragraphs.", "", "<what> should be a valid object and <where> should be either a valid object or `#-1' (denoting a location of 'nowhere'); otherwise E_INVARG is raised. The programmer must be either the owner of <what> or a wizard; otherwise, E_PERM is raised.", "", "If <where> is a valid object and isn't the same as <what>'s location, then the verb-call", "", " <where>:accept(<what>)", "", "is performed before any movement takes place. If the verb returns a false value and the programmer is not a wizard, then <where> is considered to have refused entrance to <what>; `move()' raises E_NACC. If <where> does not define an `accept' verb, then it is treated as if it defined one that always returned false.", "", "If moving <what> into <where> would create a loop in the containment hierarchy (i.e., <what> would contain itself, even indirectly), then E_RECMOVE is raised instead.", "", "The `location' property of <what> is changed to be <where>, and the `contents' properties of the old and new locations are modified appropriately. If <position> is specified, the object will be inserted into the `contents' property of the new location at <position>.", "", "If <where> differs from <what>'s current location, two additional verb calls take place. Let <old-where> be the location of <what> before it was moved. If <old-where> is a valid object, then the verb-call", "", " <old-where>:exitfunc(<what>)", "", "is performed and its result is ignored; it is not an error if <old-where> does not define a verb named `exitfunc'. Finally, if <where> and <what> are still valid objects, and <where> is still the location of <what>, then the verb-call", "", " <where>:enterfunc(<what>)", "", "is performed and its result is ignored; again, it is not an error if <where> does not define a verb named `enterfunc'."}
9 .open_network_connection() glorp rc {"Syntax: open_network_connection (STR <host>, INT <port> [, MAP <options>]) => obj", "", "Establishes a network connection to the place specified by the arguments and more-or-less pretends that a new, normal player connection has been established from there. The new connection, as usual, will not be logged in initially and will have a negative object number associated with it for use with `read()', `notify()', and `boot_player()'. This object number is the value returned by this function.", "", "If the programmer is not a wizard or if the `OUTBOUND_NETWORK' compilation option was not used in building the server, then `E_PERM' is raised. If outbound networking support is present but disabled at runtime, E_PERM is raised with a value indicating that outbound network connections are disabled.", "", "<Host> refers to a string naming a host (possibly a numeric IP address) and <port> is an integer referring to a TCP port number. If a connection cannot be made because the host does not exist, the port does not exist, the host is not reachable or refused the connection, `E_INVARG' is raised. If the connection cannot be made for other reasons, including resource limitations, then `E_QUOTA' is raised. When these errors are caught, the error value may include more specific diagnostic information such as address lookup, socket, connection, or TLS failure details.", "", "Optionally, you can specify a map with any or all of the following options:", "", " listener: An object whose listening verbs will be called at appropriate points. (See HELP LISTEN() for more details.)", " tls: If true, establish a secure TLS connection.", " ipv6: If true, utilize the IPv6 protocol rather than the IPv4 protocol.", " tls_verify: If true, verify the remote TLS peer. This option is available only when ToastStunt was built with TLS support.", "", "When opening an outbound TLS connection, ToastStunt sends Server Name Indication (SNI) using the supplied host name.", "", "The outbound connection process involves certain steps that can take quite a long time, during which the server is not doing anything else, including responding to user commands and executing MOO tasks. See the chapter on server assumptions about the database for details about how the server limits the amount of time it will wait for these steps to successfully complete.", "", "It is worth mentioning one tricky point concerning the use of this function. Since the server treats the new connection pretty much like any normal player connection, it will naturally try to parse any input from that connection as commands in the usual way. To prevent this treatment, you should use `set_connection_option()' to set the `hold-input' option true on the connection.", "", "Example:", ">;open_network_connection(\"2607:5300:60:4be0::\", 1234, [\"ipv6\" -> 1, \"listener\" -> #6, \"tls\" -> 1])", "Open a new connection to the IPv6 address 2607:5300:60:4be0:: on port 1234 using TLS. Relevant verbs will be called on #6."}
10 .binary_hash() glorp rc {"Syntax: string_hash (STR string [, STR algo [, ANY binary]]) => STR", " binary_hash (STR bin-string [, STR algo [, ANY binary]]) => STR", "", "string_hash -- Returns a hexadecimal or binary hash string.", "binary_hash -- Returns a hexadecimal or binary hash string.", "", "Returns a string encoding the result of applying a cryptographic hash function to the contents of the string text or the binary string bin-string. By default, SHA256 is used and the result is a 64-character hexadecimal string. If algo is provided, it specifies the hashing algorithm to use. Supported algorithms are MD5, SHA1, SHA224, SHA256, SHA384, SHA512, and RIPEMD160. If binary is true, the raw binary hash is returned instead of hexadecimal text.", "", "Note that the MD5 hash algorithm is broken from a cryptographic standpoint, as is SHA1. Both are included for interoperability with existing applications (both are still popular).", "", "All supported hash functions have 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 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."}
11 .descendents() glorp rc {"*forward*", "descendants"}
12 .notify() glorp rc {"Function: INT notify (OBJ conn, STR string [, INT no-flush [, INT suppress-newline]])", "", "Enqueues <string> for output (on a line by itself) on the connection <conn>. If the programmer is not <conn> or a wizard, then E_PERM is raised. If <conn> is not a currently-active connection, then this function does nothing. Output is normally written to connections only between tasks, not during execution.", "", "The server will not queue an arbitrary amount of output for a connection; the `MAX_QUEUED_OUTPUT' compilation option (in `options.h') controls the limit. When an attempt is made to enqueue output that would take the server over its limit, it first tries to write as much output as possible to the connection without having to wait for the other end. If that doesn't result in the new output being able to fit in the queue, the server starts throwing away the oldest lines in the queue until the new output will fit. The server remembers how many lines of output it has `flushed' in this way and, when next it can succeed in writing anything to the connection, it first writes a line like `>> Network buffer overflow: X lines of output to you have been lost <<' where <X> is the number of flushed lines.", "", "If <no-flush> is provided and true, then `notify()' never flushes any output from the queue; instead it immediately returns false. `notify()' otherwise returns true.", "", "If <suppress-newline> is provided and true, then `notify()' does not add a newline at the end of the string."}
13 .queue_info() glorp rc {"Function: LIST queue_info([obj user])", " MAP queue_info([obj user])", "", "Returns the number of forked tasks that <user> has at the moment. Since it doesn't say which tasks, security is not a significant issue. If no argument is given, then gives a list of all users with task queues in the server. (Essentially all connected players + all open connections + all users with tasks running in the background.)", "", "If the caller is a wizard a map of debug information about task queues will be returned."}
14 .queued_tasks() glorp rc {"Syntax: queued_tasks ([INT <show-runtime-or-count-only> [, INT <count-only>]]) => LIST|INT", "", "Returns information on each of the background tasks (i.e., forked, suspended, or reading) owned by the programmer (or, if the programmer is a wizard, all queued tasks). The returned value is a list of lists, each of which encodes certain information about a particular queued task in the following format:", "", " {<task-id>, <start-time>, <ticks>, <clock-id>,", " <programmer>, <verb-loc>, <verb-name>, <line>, <this>, <task-size>}", "", "where <task-id> is a numeric identifier for this queued task, <start-time> is the time after which this task will begin execution (in `time()' format), <ticks> is the number of ticks this task will have when it starts (always 20,000 now, though this is changeable. This makes this value obsolete and no longer interesting), <clock-id> is a number whose value is no longer interesting, <programmer> is the permissions with which this task will begin execution (and also the player who \"owns\" this task), <verb-loc> is the object on which the verb that forked this task was defined at the time, <verb-name> is that name of that verb, <line> is the number of the first line of the code in that verb that this task will execute, and <this> is the value of the variable `this' in that verb. For reading tasks, <start-time> is `-1'. <task-size> is in bytes, and is the size of memory in use by the task for local variables, stack frames, etc.", "", "If exactly one argument is provided and it is true, all variables present in the task are presented in a map with the variable name as the key and its value as the value.", "", "If two arguments are provided and the second argument is true, then only the number of tasks is returned. This is significantly more performant than length(queued_tasks()). Runtime variables are not included when two arguments are provided, so queued_tasks(1, 0) returns the normal task list without runtime variables.", "", "The <ticks> and <clock-id> fields are now obsolete and are retained only for backward-compatibility reasons. They may disappear in a future version of the server."}
15 .random() glorp rc {"Function: int random ([INT mod [,INT range]])", "", "random -- Return a random integer ", "", "mod must be a positive integer; otherwise, E_INVARG is raised. If mod is not provided, it defaults to the largest MOO integer, which will depend on if you are running 32 or 64bit.", "", "if range is provided then an integer in the range of mod to range (inclusive) is returned.", "", "random(10) => integer between 1-10", "random() => integer between 1 and maximum integer supported", "random(1, 5000) => integer between 1 and 5000"}
16 .string_hash() glorp rc {"*forward*", "binary_hash()"}
17 .task_stack() glorp rc {"Function: task_stack (INT task-id [, INT include-line-numbers [, INT include-variables]]) => 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.", "", "If include-line-numbers is passed and true, line numbers will be included.", "", "If include-variables is passed and true, variables will be included with each frame of the provided task."}
18 .value_hash() glorp rc {"Function: str value_hash(value, [, STR algo [, binary])", "", "Returns the same string as string_hash(toliteral(value)). ", "", "See the description of string_hash() for details."}
19 .acosh() glorp rc {"Syntax: acosh(FLOAT x) => FLOAT", "", "Returns the inverse hyperbolic cosine of x. Raises E_INVARG if x is less than 1.0."}
20 .add_property() glorp rc {"Syntax: add_property (OBJ <object>, STR <prop-name>, <value>, LIST <info>) => none", "", "Defines a new property on the given <object>, inherited by all of its descendants; the property is named <prop-name>, its initial value is <value>, and its owner and initial permission bits are given by <info> in the same format as is returned by property_info(). The object argument must be a permanent object; anonymous objects cannot have new properties added directly to them.", "", "If <object> is not a permanent object, then E_TYPE is raised. If <object> is not valid or <object> already has a property named <prop-name> or <info> does not specify a legitimate owner and permission bits, then E_INVARG is raised. If the programmer does not have write permission on <object> or if the owner specified by <info> is not the programmer and the programmer is not a wizard, then E_PERM is raised."}
21 .add_verb() glorp rc {"Syntax: add_verb (OBJ <object>, LIST <info>, LIST <args>) => INT", "", "Defines a new verb on the given <object>. The new verb's owner, permission bits and name(s) are given by <info> in the same format as is returned by verb_info(). The new verb's direct-object, preposition, and indirect-object specifications are given by <args> in the same format as is returned by verb_args(). The new verb initially has the empty program associated with it; this program does nothing but return an unspecified value. The object argument must be a permanent object; anonymous objects cannot have new verbs added directly to them. On success, the returned integer is the one-based number of the new verb on <object>.", "", "If <object> is not a permanent object, then E_TYPE is raised. If <object> is not valid, or <info> does not specify a legitimate owner and permission bits, or <args> is not a legitimate syntax specification, then E_INVARG is raised. If the programmer does not have write permission on <object> or if the owner specified by <info> is not the programmer and the programmer is not a wizard, then E_PERM is raised."}
22 .all_members() glorp rc {"Syntax: all_members(ANY <value>, LIST <alist>) => LIST", "", "Returns the indices of every instance of <value> in <alist>.", "", "Example:", ";all_members(\"a\", {\"a\", \"b\", \"a\", \"c\", \"a\", \"d\"}) => {1, 3, 5}"}
23 .ancestors() glorp rc {"Syntax: ancestors(OBJ <object> [, INT <full>]) => LIST", "", "Return a list of all ancestors of <object> in order ascending up the inheritance hiearchy. If <full> is true, <object> will be included in the list."}
24 .anon() glorp rc {"Syntax: anon([LIST command [, value]]) => LIST", "", "Returns anonymous-object debugging information. This function is registered only in non-NDEBUG builds and is intended for development/debugging. The programmer must be a wizard, or E_PERM is raised. With no arguments, it returns the available anonymous-object debug commands."}
25 .argon2() glorp rc {"Syntax: argon2 (STR <password>, STR <salt> [, <iterations> 3] [, <memory usage in KB> 4096] [, <CPU threads> 1]) => STR", "", "The function `argon2()' hashes a password using the Argon2id password hashing algorithm. The programmer must be a wizard, or E_PERM is raised. It is parametrized by three optional arguments:", "", " * Time: This is the number of times the hash will get run. This defines the amount of computation required and, as a result, how long the function will take to complete.", " * Memory: This is how much RAM is reserved for hashing.", " * Parallelism: This is the number of CPU threads that will run in parallel.", "", "The salt for the password should, at minimum, be 16 bytes for password hashing. It is recommended to use the random_bytes() function."}
26 .argon2_verify() glorp rc {"Syntax: argon2_verify (STR <hash>, STR <password>) => INT", "", "Compares <password> to the previously hashed <hash>. The programmer must be a wizard, or E_PERM is raised. Returns 1 if the two match or 0 if they don't."}
27 .asinh() glorp rc {"Syntax: asinh(FLOAT x) => FLOAT", "", "Returns the inverse hyperbolic sine of x."}
28 .atan2() glorp rc {"Syntax: atan2(FLOAT y, FLOAT x) => FLOAT", "", "Returns the arc-tangent of y/x in the range [-pi..pi]."}
29 .atanh() glorp rc {"Syntax: atanh(FLOAT x) => FLOAT", "", "Returns the inverse hyperbolic tangent of x. Raises E_INVARG if x is outside the range [-1.0..1.0]."}
30 .binary_hmac() glorp rc {"Syntax: string_hmac (STR text, STR key [, STR algo [, binary]])", " binary_hmac (STR bin-string, STR key [, STR algo [, binary]])", "", "Returns a string encoding the result of applying the HMAC-SHA256 cryptographically secure HMAC function to the contents of the string text or the binary string bin-string with the specified secret key. If algo is provided, it specifies the hashing algorithm to use. Currently, only \"SHA1\" and \"SHA256\" are supported. If binary is provided and true, the result is in MOO binary string format; by default the result is a hexidecimal string.", "", "All cryptographically secure HMACs have the property that, if string_hmac(x, a) == string_hmac(y, b) then, almost certainly, equal(x, y) and furthermore, equal(a, b)", "", " This can be useful, for example, in applications that need to verify both the integrity of the message (the text) and the authenticity of the sender (as demonstrated by the possession of the secret key)."}
31 .buffered_output_length() glorp rc {"Function: INT buffered_output_length ([OBJ conn])", "", "With no arguments, returns the maximum number of bytes that will be buffered for output on any connection.", "", "With a connection argument, returns the number of bytes currently buffered for output to that connection.", "", "If <conn> is not a currently-active connection, then E_INVARG is raised. If the programmer is not <conn> or a wizard, then E_PERM is raised."}
32 .cbrt() glorp rc {"Syntax: cbrt(FLOAT x) => FLOAT", "", "Returns the cube root of x."}
33 .chparent() glorp rc {"Syntax: chparent (OBJ object, OBJ new-parent) => NONE", " chparents (OBJ object, LIST new-parents) => NONE", "", "chparent -- Changes the parent of object to be new-parent.", "chparents -- Changes the parent of object to be new-parents.", "", "If object is not valid, or if new-parent is neither valid nor equal to #-1, then E_INVARG is raised. If the programmer is neither a wizard or the owner of object, or if new-parent is not fertile (i.e., its f bit is not set) and the programmer is neither the owner of new-parent nor a wizard, then E_PERM is raised. If new-parent is equal to object or one of its current ancestors, E_RECMOVE is raised. If object or one of its descendants defines a property with the same name as one defined either on new-parent or on one of its ancestors, then E_INVARG is raised.", "", "Changing an object's parent can have the effect of removing some properties from and adding some other properties to that object and all of its descendants (i.e., its children and its children's children, etc.). Let common be the nearest ancestor that object and new-parent have in common before the parent of object is changed. Then all properties defined by ancestors of object under common (that is, those ancestors of object that are in turn descendants of common) are removed from object and all of its descendants. All properties defined by new-parent or its ancestors under common are added to object and all of its descendants. As with create(), the newly-added properties are given the same permission bits as they have on new-parent, the owner of each added property is either the owner of the object it's added to (if the c permissions bit is set) or the owner of that property on new-parent, and the value of each added property is clear; see the description of the built-in function clear_property() for details. All properties that are not removed or added in the reparenting process are completely unchanged.", "", "If new-parent is equal to #-1, then object is given no parent at all; it becomes a new root of the parent/child hierarchy. In this case, all formerly inherited properties on object are simply removed.", "", "If new-parents is equal to {}, then object is given no parent at all; it becomes a new root of the parent/child hierarchy. In this case, all formerly inherited properties on object are simply removed.", "", "Warning: On the subject of multiple inheritance, the author (Slither) thinks you should completely avoid it. Prefer composition over inheritance.", ""}
34 .chparents() glorp rc {"*forward*", "chparent()"}
35 .chr() glorp rc {"Syntax: chr(INT|STR|LIST <arg>, ...) => STR", "", "This function translates byte values into ASCII characters. Arguments may be integers, strings, or lists of values that can be encoded as bytes.", "For wizard programmers, integer byte values may be between 0 and 255. If the programmer is not a wizard, integer byte values must be between 32 and 254; otherwise, E_INVARG is raised. This prevents control characters, newlines, and invalid byte values from being written to the database file by non-trusted individuals."}
36 .connection_info() glorp rc {"Syntax: connection_info (OBJ <connection>) => MAP", "", "Returns a MAP of network connection information for <connection>. At the time of writing, the following information is returned:", "", "destination_address: The hostname of the connection. For incoming connections, this is the hostname of the connected user.", " For outbound connections, this is the hostname of the outbound connection's destination.", "", "destination_ip: The unresolved numeric IP address of the connection.", "", "destination_port: For incoming connections, this is the local port used to make the connection.", " For outbound connections, this is the port the connection was made to.", "", "source_address: This is the hostname of the interface an incoming connection was made on. For outbound connections, this value is meaningless.", "", "source_ip: The unresolved numeric IP address of the interface a connection was made on. For outbound connections, this value is meaningless.", "", "source_port: The local port a connection connected to. For outbound connections, this value is meaningless.", "", "protocol: Describes the protocol used to make the connection. At the time of writing, this could be IPv4 or IPv6.", "", "outbound: Indicates whether a connection is outbound or not", "", "tls: TLS connection information. This key is present only when ToastStunt was built with USE_TLS support.", "", "E_INVARG is raised if <connection> is not valid or is disconnecting. E_PERM is raised if the programmer is not a wizard and is not <connection>."}
37 .connection_name() glorp rc {"Syntax: connection_name (OBJ <player>, [INT method]) => STR", "", "When provided just a player object this function only returns obj's hostname (e.g. 1-2-3-6.someplace.com). An optional argument allows you to specify 1 if you want a numeric IP address, or 2 if you want to return the legacy connection_name string.", "", "Warning: If you are using a LambdaMOO core, this is a semi-breaking change. You'll want to update any code on your server that runs connection_name to pass in the argument for returning the legacy connection_name string if you want things to work exactly the same.", "", "If the programmer is not a wizard and not player, then E_PERM is raised. If player is not currently connected, then E_INVARG is raised.", "", "Legacy Connection String Information:", "", "For the TCP/IP networking configurations, for in-bound connections, the string has the form:", "", "\"port lport from host, port port\"", "", "where lport is the decimal TCP listening port on which the connection arrived, host is either the name or decimal TCP address of the host from which the player is connected, and port is the decimal TCP port of the connection on that host.", "", "For outbound TCP/IP connections, the string has the form", "", "\"port lport to host, port port\"", "", "where lport is the decimal local TCP port number from which the connection originated, host is either the name or decimal TCP address of the host to which the connection was opened, and port is the decimal TCP port of the connection on that host.", "", "For the System V 'local' networking configuration, the string is the UNIX login name of the connecting user or, if no such name can be found, something of the form:", "", "\"User #number\"", "", "where number is a UNIX numeric user ID.", "", "For the other networking configurations, the string is the same for all connections and, thus, useless."}
38 .connection_name_lookup() glorp rc {"Syntax: connection_name_lookup (OBJ <connection> [, INT record_result]) => STR", "", "This function performs a DNS name lookup on connection's IP address. If a hostname can't be resolved, the function simply returns the numeric IP address. Otherwise, it will return the resolved hostname.", "", "If record_result is true, the resolved hostname will be saved with the connection and will overwrite it's existing 'connection_name()'. This means that you can call 'connection_name_lookup()' a single time when a connection is created and then continue to use 'connection_name()' as you always have in the past.", "", "This function is primarily intended for use when the 'NO_NAME_LOOKUP' server option is set. Barring temporarily failures in your nameserver, very little will be gained by calling this when the server is performing DNS name lookups for you.", "", "NOTE: This function runs in a separate thread. While this is good for performance (long lookups won't lock your MOO like traditional pre-2.6.0 name lookups), it also means it will require slightly more work to create an entirely in-database DNS lookup solution. Because it explicitly suspends, you won't be able to use it in 'do_login_command()' without also using the 'switch_player()' function. For an example of how this can work, see '#0:do_login_command()' in ToastCore."}
39 .connection_options() glorp rc {"Syntax: connection_options (OBJ <conn> [, STR <option>]) => LIST | value", "", "Returns option information for the active connection <conn>. If <option> is omitted, the result is a list of {option, value} pairs for all available connection options. If <option> is provided, only the value of that option is returned.", "", "If <conn> is not a currently-active connection, then E_INVARG is raised. If <option> is provided and does not name an available option, then E_INVARG is raised. If the programmer is not <conn> or a wizard, then E_PERM is raised.", "", "The returned options include server, task, and network connection options such as binary and other options supported by the current network configuration."}
40 .create() glorp rc {"Syntax: create (obj parent [, obj owner] [, int anon-flag] [, list init-args]) => OBJ", " create (list parents [, obj owner] [, int anon-flag] [, list init-args]) => OBJ", "", "Creates and returns a new object whose parents are parents (or whose parent is parent) and whose owner is as described below. If any of the given parents are not valid, or if the given parent is neither valid nor #-1, then E_INVARG is raised. The given parents objects must be valid and must be usable as a parent (i.e., their a or f bits must be true) or else the programmer must own parents or be a wizard; otherwise E_PERM is raised. Futhermore, if anon-flag is true then a must be true; and, if anon-flag is false or not present, then f must be true. Otherwise, E_PERM is raised unless the programmer owns parents or is a wizard. E_PERM is also raised if owner is provided and not the same as the programmer, unless the programmer is a wizard.", "", "After the new object is created, its initialize verb, if any, is called. If init-args were given, they are passed as args to initialize. The new object is assigned the least non-negative object number that has not yet been used for a created object. Note that no object number is ever reused, even if the object with that number is recycled.", "", " Note: This is not strictly true, especially if you are using ToastCore and the $recycler, which is a great idea. If you don't, you end up with extremely high object numbers. However, if you plan on reusing object numbers you need to consider this carefully in your code. You do not want to include object numbers in your code if this is the case, as object numbers could change. Use corified references instead (IE: @prop #0.my_object #objnum allows you to use $my_object in your code. If the object number ever changes, you can change the reference without updating all of your code.)", "", "If anon-flag is false or not present, the new object is a permanent object and is assigned the least non-negative object number that has not yet been used for a created object. Note that no object number is ever reused, even if the object with that number is recycled.", "", "If anon-flag is true, the new object is an anonymous object and is not assigned an object number. Anonymous objects are automatically recycled when they are no longer used. Anonymous objects cannot have new properties or verbs added directly to them. As of ToastStunt 2.8.0, anonymous objects that inherit from a parent are no longer invalidated merely because that parent's properties change.", "", "The owner of the new object is either the programmer (if owner is not provided), the new object itself (if owner was given and is invalid, or owner (otherwise).", "", "The other built-in properties of the new object are initialized as follows:", "", "name \"\"", "location #-1", "contents {}", "programmer 0", "wizard 0", "r 0", "w 0", "f 0", "", "The function is_player() returns false for newly created objects.", "", "In addition, the new object inherits all of the other properties on its parents. These properties have the same permission bits as on the parents. If the c permissions bit is set, then the owner of the property on the new object is the same as the owner of the new object itself; otherwise, the owner of the property on the new object is the same as that on the parent. The initial value of every inherited property is clear; see the description of the built-in function clear_property() for details.", "", "If the intended owner of the new object has a property named ownership_quota and the value of that property is an integer, then create() treats that value as a quota. If the quota is less than or equal to zero, then the quota is considered to be exhausted and create() raises E_QUOTA instead of creating an object. Otherwise, the quota is decremented and stored back into the ownership_quota property as a part of the creation of the new object."}
41 .crypt() glorp rc {"Syntax: crypt (STR text [, STR salt])", "", "Encrypts (hashes) the given text using the standard UNIX encryption method. If provided, salt should be a string at least two characters long, and it may dictate a specific algorithm to use. By default, crypt uses the original, now insecure, DES algorithm. Stunt specifically includes the BCrypt algorithm (identified by salts that start with \"$2a$\"), and may include MD5, SHA256, and SHA512 algorithms depending on the libraries used to build the server. The salt used is returned as the first part of the resulting encrypted string.", "", "Aside from the possibly-random input in the salt, the encryption algorithms are entirely deterministic. In particular, you can test whether or not a given string is the same as the one used to produce a given piece of encrypted text; simply extract the salt from the front of the encrypted text and pass the candidate string and the salt to crypt(). If the result is identical to the given encrypted text, then youve got a match.", "", "crypt(\"foobar\", \"iB\") => \"iBhNpg2tYbVjw\"", "crypt(\"foobar\", \"$1$MAX54zGo\") => \"$1$MAX54zGo$UKU7XRUEEiKlB.qScC1SX0\"", "crypt(\"foobar\", \"$5$s7z5qpeOGaZb\") => \"$5$s7z5qpeOGaZb$xkxjnDdRGlPaP7Z ... .pgk/pXcdLpeVCYh0uL9\"", "crypt(\"foobar\", \"$5$rounds=2000$5trdp5JBreEM\") => \"$5$rounds=2000$5trdp5JBreEM$Imi ... ckZPoh7APC0Mo6nPeCZ3\"", "crypt(\"foobar\", \"$6$JR1vVUSVfqQhf2yD\") => \"$6$JR1vVUSVfqQhf2yD$/4vyLFcuPTz ... qI0w8m8az076yMTdl0h.\"", "crypt(\"foobar\", \"$6$rounds=5000$hT0gxavqSl0L\") => \"$6$rounds=5000$hT0gxavqSl0L$9/Y ... zpCATppeiBaDxqIbAN7/\"", "crypt(\"foobar\", \"$2a$08$dHkE1lESV9KrErGhhJTxc.\") => \"$2a$08$dHkE1lESV9KrErGhhJTxc.QnrW/bHp8mmBl5vxGVUcsbjo3gcKlf6\"", "", "Note: The specific set of supported algorithms depends on the libraries used to build the server. Only the BCrypt algorithm, which is distributed with the server source code, is guaranteed to exist. BCrypt is currently mature and well tested, and is recommended for new development."}
42 .curl() glorp rc {"Syntax: curl(STR <url> [, INT <include_headers> [, INT timeout]]) => STR", "", "The curl builtin will download an HTTP, HTTPS, or DICT URL and return it as a string. If <include_headers> is true, the HTTP headers will be included in the return string.", "", "The programmer must be a wizard, or E_PERM is raised. If outbound networking is disabled at runtime, curl() raises E_PERM with a value indicating that outbound network connections are disabled.", "", "It's worth noting that the data you get back will be binary encoded. In particular, you will find that line breaks appear as ~0A. You can easily convert a page into a list by passing the return string into the decode_binary() function.", "", "CURL_TIMEOUT is defined in options.h to specify the maximum amount of time a CURL request can take before failing. For special circumstances, you can specify a longer or shorter timeout using the third argument of curl()."}
43 .decode_base64() glorp rc {"Syntax: decode_base64 (STR base64 [, INT safe]) => STR", "", "Returns the binary string representation of the supplied Base64 encoded string argument. Raises E_INVARG if base64 is not a properly-formed Base64 string. If safe is provide and is true, a URL-safe version of Base64 is used (see RFC4648).", "", "decode_base64(\"AAEC\") => \"~00~01~02\"", "decode_base64(\"AAE\", 1) => \"~00~01\""}
44 .delete_verb() glorp rc {"Syntax: delete_verb (OBJ <object>, STR|INT <verb-name>) => NONE", "", "BE AWARE: verb-name can be the string name of the verb OR the index from verbs()", "", "Removes the verb named <verb-name> from the given <object>. If <object> is not valid, then E_INVARG is raised. If the programmer does not have write permission on <object>, then E_PERM is raised. If <object> does not define a verb named <verb-name>, then E_VERBNF is raised."}
45 .descendants() glorp rc {"Syntax: descendants(OBJ <object> [, INT <full>]) => LIST", "", "Return a list of all nested children of <object>. If <full> is true, <object> will be included in the list."}
46 .disassemble() glorp rc {"Syntax: disassemble (OBJ object, STR|INT verb-desc) => LIST", "", "BE AWARE: verb-name can be the string name of the verb OR the index from verbs()", "", "Returns a (longish) list of strings giving a listing of the server's internal \"compiled\" form of the verb as specified by <verb-desc> on <object>. This format is not documented and may indeed change from release to release, but some programmers may nonetheless find the output of `disassemble()' interesting to peruse as a way to gain a deeper appreciation of how the server works.", "", "If <object> is not valid, then E_INVARG is raised. If <object> does not define a verb as specified by <verb-desc>, then E_VERBNF is raised. If the programmer does not have read permission on the verb in question, then disassemble() raises E_PERM."}
47 .distance() glorp rc {"Syntax: distance(LIST from, LIST to) => FLOAT", "", "Returns the Euclidean distance between two coordinate lists. Each element must be an integer or floating-point number; otherwise E_TYPE is raised."}
48 .encode_base64() glorp rc {"Syntax: encode_base64 (STR binary [, INT safe]) => STR", "", "Returns the Base64 encoded string representation of the supplied binary string argument. Raises E_INVARG if binary is not a properly-formed binary string. If safe is provide and is true, a URL-safe version of Base64 is used (see RFC4648).", "", "encode_base64(\"~00~01~02\") => \"AAEC\"", "encode_base64(\"~00~01\", 1) => \"AAE\""}
49 .eval() glorp rc {"Syntax: eval (STR <line> [, STR <line> ...]) => LIST", "", "The MOO-code compiler processes the given strings as if they were the program associated with some verb and, if no errors are found, that fictional verb is invoked.", "", "If the programmer is not a programmer, then E_PERM is raised. If any argument is not a string, then E_TYPE is raised.", "", "The normal result is a two-element list. The first element is true if there were no compilation errors and false otherwise. The second element is either the result returned from the fictional verb, if there were no compilation errors, or a list of the compiler's error messages otherwise.", "", "When the fictional verb is invoked, player has the same value as in the calling verb, this is #-1, caller is the initial value of this in the calling verb, args is {}, argstr is \"\", verb is \"\", dobjstr is \"\", dobj is #-1, prepstr is \"\", iobjstr is \"\", and iobj is #-1.", "", "The fictional verb runs with the permissions of the programmer and as if its d permissions bit were on.", "", "Example:", " eval(\"return 3 + 4;\") => {1, 7}"}
50 .exec() glorp rc {"Syntax: exec (LIST command [, STR input] [, LIST environment variables]) => LIST", "", "Asynchronously executes the specified external executable, optionally sending input. Returns the process return code, output and error. If the programmer is not a wizard, then E_PERM is raised.", "", "The first argument must be a list of strings, or E_INVARG is raised. The first string is the path to the executable and is required. The rest are command line arguments passed to the executable.", "", "The path to the executable may not start with a slash (/) or dot-dot (..), and it may not contain slash-dot (/.) or dot-slash (./), or E_INVARG is raised. If the specified executable does not exist or is not a regular file, E_INVARG is raised.", "", "If the string input is present, it is written to standard input of the executing process.", "", "Additionally, you can provide a list of environment variables to set in the shell.", "", "When the process exits, it returns a list of the form:", "", "{code, output, error}", "", "code is the integer process exit status or return code. output and error are strings of data that were written to the standard output and error of the process.", "", "The specified command is executed asynchronously. The function suspends the current task and allows other tasks to run until the command finishes. Tasks suspended this way can be killed with kill_task().", "", "The strings, input, output and error are all MOO binary strings.", "", "All external executables must reside in the executables directory.", "", "exec({\"cat\", \"-?\"}) => {1, \"\", \"cat: illegal option -- ?~0Ausage: cat [-benstuv] [file ...]~0A\"}", "exec({\"cat\"}, \"foo\") => {0, \"foo\", \"\"}", "exec({\"echo\", \"one\", \"two\"}) => {0, \"one two~0A\", \"\"}"}
51 .exp() glorp rc {"Syntax: exp (FLOAT x)", "", "Returns E (Eulers number) raised to the power of x. "}
52 .explode() glorp rc {"Syntax: explode(STR subject [, STR break [, INT include-sequential-occurrences]) => LIST", "", "Returns a list of substrings of subject that are separated by break. break defaults to a space.", "", "Only the first character of break is considered:", "", "explode(\"slither%is%wiz\", \"%\") => {\"slither\", \"is\", \"wiz\"}", "explode(\"slither%is%%wiz\", \"%%\") => {\"slither\", \"is\", \"wiz\"}", "", "You can use include-sequential-occurrences to get back an empty string as part of your list if break appears multiple times with nothing between it, or there is a leading/trailing break in your string:", "", "explode(\"slither%is%%wiz\", \"%%\", 1) => {\"slither\", \"is\", \"\", \"wiz\"}", "explode(\"slither%is%%wiz%\", \"%\", 1) => {\"slither\", \"is\", \"\", \"wiz\", \"\"}", "explode(\"%slither%is%%wiz%\", \"%\", 1) => {\"\", \"slither\", \"is\", \"\", \"wiz\", \"\"}", "", "Note: This can be used as a replacement for $string_utils:explode.", ""}
53 .file_chmod() glorp rc {"Function: void file_chmod(STR filename, STR mode)", "", " Attempts to set mode of a file using mode as an octal string of", " exactly three characters.", "", " This is implemented using chmod()."}
54 .file_close() glorp rc {" Function: void file_close(FHANDLE fh)", "", " Closes the file associated with fh.", "", " This is implemented using fclose()."}
55 .file_count_lines() glorp rc {"Function: INT file_count_lines(FHANDLE fh)", "", "Count the lines in a file. This rewinds the file and reads to EOF while counting, leaving the stream positioned at EOF.", "", "", ""}
56 .file_eof() glorp rc {"Function: INT file_eof(FHANDLE fh)", "", " Returns true if and only if fh's stream is positioned at EOF.", "", " This is implemented using feof()."}
57 .file_flush() glorp rc {"Function: void file_flush(FHANDLE fh)", "", " Flushes buffered writes for the file.", "", " This is implemented using fflush()."}
58 .file_grep() glorp rc {"Function: LIST file_grep(FHANDLE fh, STR search [,?match_all = 0])", "", "Search for a string in a file.", "", "Assume we have a file `test.txt` with the contents:", "", "asdf asdf 11", "11", "112", "", "And we have an open file handle from running:", "", ";file_open(\"test.txt\", \"r-tn\")", "", "If we were to execute a file grep:", "", ";file_grep(1, \"11\")", "", "We would get the first result:", "", "{{\"asdf asdf 11\", 1}}", "", "The resulting LIST is of the form {{STR match, INT line-number}}", "", "If you pass in the optional third argument", "", ";file_grep(1, \"11\", 1)", "", "we will receive all the matching results:", "", "{{\"asdf asdf 11\", 1}, {\"11\", 2}, {\"112\", 3}}"}
59 .file_handles() glorp rc {"Function: LIST file_handles()", "", "Return a list of open files.", ""}
60 .file_last_access() glorp rc {"Function: INT file_last_access(STR pathname)", " INT file_last_access(FHANDLE fh)", "", " Returns the last access time of the given pathname or handle, in the same time representation used by time().", "", " This is implemented using stat() or fstat()."}
61 .file_last_change() glorp rc {"Function: INT file_last_change(STR pathname)", " INT file_last_change(FHANDLE fh)", "", " Returns the last status-change time of the given pathname or handle, in the same time representation used by time().", "", " This is implemented using stat() or fstat()."}
62 .file_last_modify() glorp rc {"Function: INT file_last_modify(STR pathname)", " INT file_last_modify(FHANDLE fh)", "", " Returns the last modification time of the given pathname or handle, in the same time representation used by time().", "", " This is implemented using stat() or fstat()."}
63 .file_list() glorp rc {"Function: LIST file_list(STR pathname, [ANY detailed])", "", " Attempts to list the contents of the given directory. Returns a list", " of files in the directory. If the detailed argument is provided and", " true, then the list contains detailed entries, otherwise it contains a", " simple list of names.", "", " detailed entry:", " {STR filename, STR file type, STR file mode, INT file size}", " normal entry:", " STR filename", "", " This is implemented using opendir() and readdir(); output order is not guaranteed."}
64 .file_mkdir() glorp rc {"Function: void file_mkdir(STR pathname)", "", " Attempts to create the given directory.", "", " This is implemented using mkdir()."}
65 .file_mode() glorp rc {" Function: STR file_mode(STR filename)", " STR file_mode(FHANDLE fh)", "", " Returns octal mode for a file (e.g. \"644\").", "", " This is implemented using stat() or fstat()."}
66 .file_name() glorp rc {"Function: STR file_name(FHANDLE fh)", "", " Returns the pathname originally associated with fh by file_open().", " This is not necessarily the file's current name if it was renamed or", " unlinked after the fh was opened."}
67 .file_open() glorp rc {" Function: FHANDLE file_open(STR pathname, STR mode)", "", " Raises: E_INVARG if mode is not a valid mode, E_QUOTA if too many files are open.", " This opens a file specified by pathname and returns an FHANDLE for it.", " It ensures pathname is legal. Mode is a string of characters indicating what mode the file is opened in. ", " The mode string is four characters.", "", " The first character must be (r)ead, (w)rite, or (a)ppend. The second must be '+' or '-'. This modifies the previous argument.", "", " o r- opens the file for reading and fails if the file does not exist.", "", " o r+ opens the file for reading and writing and fails if the file", " does not exist.", "", " o w- opens the file for writing, truncating if it exists and creating", " if not.", "", " o w+ opens the file for reading and writing, truncating if it exists", " and creating if not.", "", " o a- opens a file for writing, creates it if it does not exist and", " positions the stream at the end of the file.", "", " o a+ opens the file for reading and writing, creates it if does not", " exist and positions the stream at the end of the file.", "", " The third character is either (t)ext or (b)inary. In text mode,", " data is written as-is from the MOO and data read in by the MOO is", " stripped of unprintable characters. In binary mode, data is", " written filtered through the binary-string->raw-bytes conversion", " and data is read filtered through the raw-bytes->binary-string", " conversion. For example, in text mode writing \" 1B\" means three", " bytes are written: ' ' Similarly, in text mode reading \" 1B\" means", " the characters ' ' '1' 'B' were present in the file. In binary", " mode reading \" 1B\" means an ASCII ESC was in the file. In text", " mode, reading an ESC from a file results in the ESC getting", " stripped.", "", " It is not recommended that files containing unprintable ASCII data be", " read in text mode, for obvious reasons.", "", " The final character is either 'n' or 'f'. If this character is 'f',", " whenever data is written to the file, the MOO will force it to finish", " writing to the physical disk before returning. If it is 'n' then", " this won't happen.", "", " This is implemented using fopen()."}
68 .file_openmode() glorp rc {"Function: STR file_openmode(FHANDLE fh)", "", " Returns the normalized mode for the file associated with fh.", " This reflects the handle's current read/write, text/binary, and flush", " flags, and is not guaranteed to match the exact string originally", " passed to file_open()."}
69 .file_read() glorp rc {"Function: STR file_read(FHANDLE fh, INT bytes)", "", " Reads up to the specified number of bytes from the file and returns", " them.", "", " Not recommended for use on files in text mode.", "", " This is implemented using fread()."}
70 .file_readline() glorp rc {"Function: STR file_readline(FHANDLE fh)", "", " Reads the next line in the file and returns it (without the newline).", "", " Not recommended for use on files in binary mode.", "", " This is implemented using fgetc()."}
71 .file_readlines() glorp rc {" Function: LIST file_readlines(FHANDLE fh, INT start, INT end)", "", " Rewinds the file and then reads the specified lines from the file,", " returning them as a list of strings. After this operation, the stream", " is positioned at the start of the first returned line.", "", " Not recommended for use on files in binary mode.", "", " This is implemented using fgetc()."}
72 .file_remove() glorp rc {"Function: void file_remove(STR pathname)", "", " Attempts to remove the given file.", "", " This is implemented using remove()."}
73 .file_rename() glorp rc {"Function: void file_rename(STR oldpath, STR newpath)", "", " Attempts to rename the oldpath to newpath.", "", " This is implemented using rename()."}
74 .file_rmdir() glorp rc {"Function: void file_rmdir(STR pathname)", "", " Attempts to remove the given directory.", "", " This is implemented using rmdir()."}
75 .file_seek() glorp rc {"Function: void file_seek(FHANDLE fh, INT loc, STR whence)", "", " Seeks to a particular location in a file. whence is one of the", " strings:", "", " o \"SEEK_SET\" - seek to location relative to beginning", "", " o \"SEEK_CUR\" - seek to location relative to current", "", " o \"SEEK_END\" - seek to location relative to end", "", " This is implemented using fseek()."}
76 .file_size() glorp rc {"Function: INT file_size(STR pathname)", " INT file_size(FHANDLE fh)", "", " Returns the size in bytes of the given pathname or handle.", "", " This is implemented using stat() or fstat()."}
77 .file_stat() glorp rc {" Function: LIST file_stat(STR pathname)", " Function: LIST file_stat(FHANDLE fh)", "", " Returns the result of stat() (or fstat()) on the given file.", " Specifically a list as follows:", "", " {file size in bytes, file type, file access mode, owner, group,", " last access, last modify, and last change}", "", " owner and group are always the empty string.", "", " It is recommended that the specific information functions file_size,", " file_type, file_mode, file_last_access, file_last_modify, and", " file_last_change be used instead. In most cases only one of these", " elements is desired and in those cases there's no reason to make and", " free a list."}
78 .file_tell() glorp rc {"Function: INT file_tell(FHANDLE fh)", "", " Returns position in file.", "", " This is implemented using ftell()."}
79 .file_type() glorp rc {"Function: STR file_type(STR pathname)", " STR file_type(FHANDLE fh)", "", " Returns the type of the given pathname or handle, one of \"reg\",", " \"dir\", \"fifo\", \"block\", \"socket\", or \"unknown\".", "", " This is implemented using stat() or fstat()."}
80 .file_write() glorp rc {"Function: INT file_write(FHANDLE fh, STR data)", "", " Writes the specified data to the file. Returns number of bytes", " written.", "", " Not recommended for use on files in text mode.", "", " This is implemented using fwrite()."}
81 .file_writeline() glorp rc {" Function: void file_writeline(FHANDLE fh, STR line)", "", " Writes the specified line to the file (adding a newline).", "", " Not recommended for use on files in binary mode.", "", " This is implemented using fputs()"}
82 .finished_tasks() glorp rc {"Syntax: finished_tasks () => LIST", "", "When enabled (via SAVE_FINISHED_TASKS in options.h), the server will keep track of the execution time of every task that passes through the interpreter. This built-in is registered only in builds with SAVE_FINISHED_TASKS enabled. The programmer must be a wizard, or E_PERM is raised. This data is then made available to the database in two ways.", "", "The first is the finished_tasks() function. This function will return a list of maps of the last several finished tasks (configurable via $server_options.finished_tasks_limit) with the following information:", "", "", "Foreground: True if this was a foreground task.", "Fullverb: The full name of the verb being executed.", "Object: The object the verb is defined on.", "Player: The result of the 'player' variable.", "Programmer: The player whose permissions the verb is running as.", "Receiver: The object that received the verb invocation. In the case of primitives, this is the primitive's object handler.", "Suspended: True if the task suspended instead of finishing.", "This: The result of the 'this' variable.", "Time: The total time the task took inside the interpreter.", "Verb: The verb name used to invoke the task.", "", "", "The second is via the $handle_lagging_task verb. When the execution threshold defined in $server_options.task_lag_threshold is exceeded, the server will write an entry to the log file and call the $handle_lagging_task verb with the call stack of the task as well as the execution time."}
83 .frandom() glorp rc {"Syntax: frandom (FLOAT <mod1> [, FLOAT <mod2>]) => FLOAT", "", "If only one argument is given, a floating point number is chosen randomly from the range `[1.0..<mod1>]` and returned. If two arguments are given, a floating point number is randomly chosen from the range `[<mod1>..<mod2>]`. "}
84 .ftime() glorp rc {"Syntax: ftime ([INT monotonic]) => FLOAT", "", "Returns the current time represented as the number of seconds and nanoseconds that have elapsed since midnight on 1 January 1970, Greenwich Mean Time.", "", "If the <monotonic> argument is supplied and set to 1, the time returned will be monotonic. This means that will you will always get how much time has elapsed from an arbitrary, fixed point in the past that is unaffected by clock skew or other changes in the wall-clock. This is useful for benchmarking how long an operation takes, as it's unaffected by the actual system time.", "", "The general rule of thumb is that you should use ftime() with no arguments for telling time and ftime() with the monotonic clock argument for measuring the passage of time."}
85 .gc_stats() glorp rc {"Syntax: gc_stats() => MAP", "", "Returns garbage-collector color counts. This function is available only when ToastStunt is built with garbage collection enabled. If the programmer is not a wizard, then E_PERM is raised.", "", "The returned map contains the keys green, yellow, black, gray, white, purple, and pink."}
86 .generate_json() glorp rc {"Syntax: generate_json (ANY value [, STR mode [, ANY disable_binary_escapes]])", "", "Returns the JSON representation of the MOO value.", "", "MOO supports a richer set of values than JSON allows. The optional mode specifies how this function handles the conversion of MOO values into their JSON representation.", "", "The common subset mode, specified by the literal mode string \"common-subset\", is the default conversion mode. In this mode, strings, numbers, and booleans are translated with fidelity between MOO types and JSON types. All other types are treated as alternative representations of the string type. This mode is useful for integration with non-MOO applications.", "", "The embedded types mode, specified by the literal mode string \"embedded-types\", adds type information. Specifically, values other than strings, numbers, and booleans, which carry implicit type information, are converted into strings with type information appended. The converted string consists of the string representation of the value (as if tostr() were applied) followed by the pipe (|) character and the type. This mode is useful for serializing/deserializing objects and collections of MOO values.", "", "The optional disable_binary_escapes argument controls whether MOO binary string sequences (like ~08 or ~1F) are converted to JSON escape sequences. By default, these sequences are converted (e.g., ~08 becomes \\b). If disable_binary_escapes is true, these sequences pass through unchanged.", "", "generate_json([]) => \"{}\"", "generate_json([\"foo\" -> \"bar\"]) => \"{\\\"foo\\\":\\\"bar\\\"}\"", "generate_json([\"foo\" -> \"bar\"], \"common-subset\") => \"{\\\"foo\\\":\\\"bar\\\"}\"", "generate_json([\"foo\" -> \"bar\"], \"embedded-types\") => \"{\\\"foo\\\":\\\"bar\\\"}\"", "generate_json([\"foo\" -> 1.1]) => \"{\\\"foo\\\":1.1}\"", "generate_json([\"foo\" -> 1.1], \"common-subset\") => \"{\\\"foo\\\":1.1}\"", "generate_json([\"foo\" -> 1.1], \"embedded-types\") => \"{\\\"foo\\\":1.1}\"", "generate_json([\"foo\" -> true, \"bar\" -> false]) => \"{\\\"bar\\\":false,\\\"foo\\\":true}\"", "generate_json([\"foo\" -> #1]) => \"{\\\"foo\\\":\\\"#1\\\"}\"", "generate_json([\"foo\" -> #1], \"common-subset\") => \"{\\\"foo\\\":\\\"#1\\\"}\"", "generate_json([\"foo\" -> #1], \"embedded-types\") => \"{\\\"foo\\\":\\\"#1|obj\\\"}\"", "generate_json([\"foo\" -> E_PERM]) => \"{\\\"foo\\\":\\\"E_PERM\\\"}\"", "generate_json([\"foo\" -> E_PERM], \"common-subset\") => \"{\\\"foo\\\":\\\"E_PERM\\\"}\"", "generate_json([\"foo\" -> E_PERM], \"embedded-types\") => \"{\\\"foo\\\":\\\"E_PERM|err\\\"}\"", "", "JSON keys must be strings, so regardless of the mode, the key will be converted to a string value.", "", "generate_json([1 -> 2]) => \"{\\\"1\\\":2}\"", "generate_json([1 -> 2], \"common-subset\") => \"{\\\"1\\\":2}\"", "generate_json([1 -> 2], \"embedded-types\") => \"{\\\"1|int\\\":2}\"", "generate_json([#1 -> 2], \"embedded-types\") => \"{\\\"#1|obj\\\":2}\""}
87 .getenv() glorp rc {"Syntax: getenv (STR name)", "", "Returns the value of the named environment variable. If no such environment variable exists, 0 is returned. If the programmer is not a wizard, then E_PERM is raised.", "", "getenv(\"HOME\") => \"/home/foobar\"", "getenv(\"XYZZY\") => 0"}
88 .index() glorp rc {"Syntax: index (STR str1, STR str2 [, INT case-matters [, INT skip]]) => INT", " rindex (STR str1, STR str2 [, INT case-matters [, INT skip]]) => INT", "", "index -- Returns the index of the first character of the first occurrence of str2 in str1. ", "", "rindex -- Returns the index of the first character of the last occurrence of str2 in str1.", "", "These functions will return 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.", "", "By default the search starts at the beginning (end) of str1. If skip is provided, the search skips the first (last) skip characters and starts at an offset from the beginning (end) of str1. The skip must be a positive integer for index() and a negative integer for rindex(). The default value of skip is 0 (skip no characters).", "", "index(\"foobar\", \"o\") 2", "index(\"foobar\", \"o\", 0, 0) 2", "index(\"foobar\", \"o\", 0, 2) 1", "rindex(\"foobar\", \"o\") 3", "rindex(\"foobar\", \"o\", 0, 0) 3", "rindex(\"foobar\", \"o\", 0, -4) 2", "index(\"foobar\", \"x\") 0", "index(\"foobar\", \"oba\") 3", "index(\"Foobar\", \"foo\", 1) 0", ""}
89 .isa() glorp rc {"Syntax: isa(OBJ <object>, OBJ <parent>)", " isa(OBJ <object>, LIST <parent list> [, INT <return_parent>])", "", "Returns true if <object> is a descendant of <parent>, otherwise false.", "", "If a third argument is present and true, the return value will be the first parent that object1 descends from in the <parent list>.", "", "isa(#2, $wiz) => 1", "isa(#2, {$thing, $wiz, $container}) => 1", "isa(#2, {$thing, $wiz, $container}, 1) => #57 (generic wizard)", "isa(#2, {$thing, $room, $container}, 1) => #-1 <$nothing>"}
90 .listeners() glorp rc {"Syntax: listeners ([OBJ <object> | INT <port>]) => LIST", "", "Returns a list describing existing listening points, including the default one set up automatically by the server when it was started, unless that one has since been destroyed by a call to unlisten().", "", "If an object or port is supplied, only matching listeners are returned. Each element of the returned list is a map with the following keys:", "", " object: The object whose listener verbs are called.", " port: The port or listener descriptor.", " print-messages: True if database-configurable messages are printed for this listener.", " ipv6: True if this listener uses IPv6.", " interface: The interface being listened on.", " tls: True if this listener uses TLS. This key is only present when ToastStunt has TLS support.", "", "For the initial listening point, object is #0, port is determined by the command-line arguments or a network-configuration-specific default, and print-messages is true."}
91 .locate_by_name() glorp rc {"Syntax: locate_by_name (STR <object name> [, INT <case-matters>]) => LIST", "", "This function searches every object in the database for those containing <object name> in their .name property. If <case-matters> is true, matching is case-sensitive. The programmer must be a wizard, or E_PERM is raised."}
92 .locations() glorp rc {"Syntax: locations(OBJ object [, OBJ stop [, INT is-parent]]) => LIST", "", "Recursively build a list of an object's location, its location's location, and so forth until finally hitting $nothing. Raises E_INVIND if object is not valid.", "", "Example:", "", "locations(me) => {#20381, #443, #104735}", "", "$string_utils:title_list(locations(me)) => \"\\\"Butterknife Ballet\\\" Control Room FelElk, the one-person celestial birther \\\"Butterknife Ballet\\\", and Uncharted Space: Empty Space\"", "", "If stop is in the locations found, it will stop before there and return the list (exclusive of the stop object).", "", "If the third argument is true, stop is assumed to be a PARENT. And if any of your locations are children of that parent, it stops there.", ""}
93 .log_cache_stats() glorp rc {"*forward*", "verb_cache_stats()"}
94 .malloc_stats() glorp rc {"Syntax: malloc_stats() => LIST", "", "Returns allocator statistics when ToastStunt was built with jemalloc support. The returned list has the form {allocated, active, resident, metadata, mapped, allocated-large, active-large}."}
95 .mapdelete() glorp rc {"Syntax: mapdelete (MAP map, MIXED key|LIST keys)", "", "Returns a copy of map with the value(s) corresponding to the specified key(s) removed. A single key or a list of keys can be provided.", "", "If a key is a collection value, such as a list or map, then E_TYPE is raised. If a key is valid but is not present in the map, then E_RANGE is raised. When deleting a list of keys, the E_RANGE value identifies the first missing key.", "", "x = [\"foo\" -> 1, \"bar\" -> 2, \"baz\" -> 3, \"qux\" -> 4];", "mapdelete(x, \"bar\") => [\"baz\" -> 3, \"foo\" -> 1, \"qux\" -> 4]", "mapdelete(x, {\"bar\", \"qux\"}) => [\"baz\" -> 3, \"foo\" -> 1]"}
96 .maphaskey() glorp rc {"Syntax: maphaskey (MAP <map>, ANY <key> [, INT <case-matters>]) => INT", "", "Returns 1 if <key> exists in <map>. If <case-matters> is true, string-key comparison is case-sensitive. Collection values cannot be used as keys for this lookup; if <key> is a list, map, or other collection value, E_TYPE is raised. When not dealing with hundreds of keys, this function is faster (and easier to read) than something like: !(x in mapkeys(map))"}
97 .mapkeys() glorp rc {"Syntax: mapkeys (MAP map)", "", "Returns the keys of the elements of map.", "", "x = [\"foo\" -> 1, \"bar\" -> 2, \"baz\" -> 3];", "mapkeys(x) => {\"bar\", \"baz\", \"foo\"}"}
98 .mapvalues() glorp rc {"Syntax: mapvalues (MAP <map> [, ... ANY <key>])", "", "Returns the values of the elements of map.", "", "If you only want the values of specific keys in the map, you can specify them as optional arguments. If any requested key is not present in the map, E_RANGE is raised.", "", "Examples: ", "x = [\"foo\" -> 1, \"bar\" -> 2, \"baz\" -> 3];", "", ";mapvalues(x)", "=> {2, 3, 1}", ";mapvalues(x, \"foo\", \"baz\")", "=> {1, 3}"}
99 .memory_usage() glorp rc {"Syntax: memory_usage () => LIST", "", "Return statistics concerning the server's consumption of system memory. The result is a list in the following format:", "", "{total memory used, resident set size, shared pages, text, data + stack}"}
100 .new_waif() glorp rc {"Syntax: new_waif() => WAIF", "", "The new_waif() builtin creates a new WAIF whose class is the calling object and whose owner is the perms of the calling verb.", "", "The class is the object that called the current verb, and the owner is the programmer whose permissions the task is running with. There is no alternate wizard-only calling form."}
101 .next_recycled_object() glorp rc {"Syntax: next_recycled_object([OBJ <start>]) => OBJ | INT", "", "Return the lowest invalid object. If <start> is specified, no object lower than <start> will be considered. If there are no invalid objects, this function will return 0. Raises E_INVARG if <start> is negative or greater than the last object number ever used."}
102 .occupants() glorp rc {"Syntax: occupants(LIST <objects> [, OBJ | LIST <parent>, INT <player flag set?>, INT <inverse>]) => LIST", "", "Iterates through the list of <objects> and returns those matching a specific set of criteria:", "", "1. If only <objects> is specified, the occupants function will return a list of objects with the player flag set.", "2. If the <parent> argument is specified, a list of <objects> descending from <parent> will be returned. If <parent> is a list, <object> must descend from at least one object in the list.", "3. If both <parent> and <player flag set> are specified, occupants will check both that an object is descended from <parent> and also has the player flag set.", "4. If the inverse-match is 0 (default behavior). If it is 1, then inverse the match to 'items in the list that do NOT match the parent(s)'", "", "Raises E_TYPE if <parent> is provided and is not an object or list of objects. Raises E_INVARG if <objects> is not a valid list of objects.", "", "As of ToastStunt 2.8.0, this is not a threaded function."}
103 .owned_objects() glorp rc {"Syntax: owned_objects(OBJ owner) => LIST", "", "Returns a list of all objects in the database owned by <owner>. Ownership is defined by the value of .owner on the object. Raises E_INVIND if <owner> is not valid."}
104 .parent() glorp rc {"Syntax: parent (OBJ object) => OBJ", " parents (OBJ object) => LIST", "", "parent -- return the parent of object", "parents -- return the parents of object"}
105 .parents() glorp rc {"*forward*", "parent()"}
106 .parse_ansi() glorp rc {"Syntax: parse_ansi(STR string) => STR", "", "Replaces ToastStunt ANSI tags in string with ANSI escape sequences. Recognized tags include foreground colors, background colors, style tags such as , , , , and utility tags such as , , and ."}
107 .parse_json() glorp rc {"Syntax: parse_json (STR json [, STR mode])", "", "Returns the MOO value representation of the JSON string. If the specified string is not valid JSON, E_INVARG is raised.", "", "The optional mode specifies how this function handles conversion of MOO values into their JSON representation. The options are the same as for generate_json().", "", "parse_json(\"{}\") => []", "parse_json(\"{\\\"foo\\\":\\\"bar\\\"}\") => [\"foo\" -> \"bar\"]", "parse_json(\"{\\\"foo\\\":\\\"bar\\\"}\", \"common-subset\") => [\"foo\" -> \"bar\"]", "parse_json(\"{\\\"foo\\\":\\\"bar\\\"}\", \"embedded-types\") => [\"foo\" -> \"bar\"]", "parse_json(\"{\\\"foo\\\":1.1}\") => [\"foo\" -> 1.1]", "parse_json(\"{\\\"foo\\\":1.1}\", \"common-subset\") => [\"foo\" -> 1.1]", "parse_json(\"{\\\"foo\\\":1.1}\", \"embedded-types\") => [\"foo\" -> 1.1]", "parse_json(\"{\\\"foo\\\":\\\"#1\\\"}\") => [\"foo\" -> \"#1\"]", "parse_json(\"{\\\"foo\\\":\\\"#1\\\"}\", \"common-subset\") => [\"foo\" -> \"#1\"]", "parse_json(\"{\\\"foo\\\":\\\"#1|obj\\\"}\", \"embedded-types\") => [\"foo\" -> #1]", "parse_json(\"{\\\"foo\\\":\\\"E_PERM\\\"}\") => [\"foo\" -> \"E_PERM\"]", "parse_json(\"{\\\"foo\\\":\\\"E_PERM\\\"}\", \"common-subset\") => [\"foo\" -> \"E_PERM\"]", "parse_json(\"{\\\"foo\\\":\\\"E_PERM|err\\\"}\", \"embedded-types\") => [\"foo\" -> E_PERM]", "parse_json(\"{\\\"foo\\\":true,\\\"bar\\\":false,\\\"baz\\\":null}\") => [\"bar\" -> false, \"baz\" -> E_NONE, \"foo\" -> true]", "", "In embedded types mode, key values can be converted to MOO types by appending type information. The full set of supported types are obj, str, err, float and int.", "", "parse_json(\"{\\\"1\\\":2}\") => [\"1\" -> 2]", "parse_json(\"{\\\"1\\\":2}\", \"common-subset\") => [\"1\" -> 2]", "parse_json(\"{\\\"1|int\\\":2}\", \"embedded-types\") => [1 -> 2]", "parse_json(\"{\\\"#1|obj\\\":2}\", \"embedded-types\") => [#1 -> 2]", "", "JSON boolean values are converted to MOO BOOL values. JSON null values are converted to E_NONE."}
108 .pcre_cache_stats() glorp rc {"Syntax: pcre_cache_stats() => LIST", "", "Returns statistics for the PCRE pattern cache. The programmer must be a wizard, or E_PERM is raised. Each returned entry has the form {pattern, cache-hits}."}
109 .pcre_match() glorp rc {"Syntax: pcre_match (STR <subject>, STR <pattern> [, <case matters> 0] [, <repeat until no matches> 1] => LIST", "", "The function `pcre_match()' searches <subject> for <pattern> using PCRE2 regular expressions. The return value is a list of maps containing each match. Each returned map will have a key which corresponds to either a named capture group or the number of the capture group being matched. The full match is always found in the key \"0\". The value of each key will be another map containing the keys 'match' and 'position'. Match corresponds to the text that was matched and position will return the indices of the substring within <subject>.", "", "If <repeat until no matches> is 1, the expression will continue to be evaluated until no further matches can be found or it exhausts the iteration limit. This defaults to 1.", "", "Empty patterns raise E_INVARG. Empty subjects are valid, but the current implementation returns an empty list without attempting a zero-length match.", "", "Additionally, wizards can control how many iterations of the loop are possible by adding a property to $server_options. $server_options.pcre_match_max_iterations is the maximum number of loops allowed before giving up and allowing other tasks to proceed. CAUTION: It's recommended to keep this value fairly low. The default value is 1000. The minimum value is 100.", "", "Examples:", "", "Extract dates from a string:", "pcre_match(\"09/12/1999 other random text 01/21/1952\", \"([0-9]{2})/([0-9]{2})/([0-9]{4})\")", "=> {[\"0\" -> [\"match\" -> \"09/12/1999\", \"position\" -> {1, 10}], \"1\" -> [\"match\" -> \"09\", \"position\" -> {1, 2}], \"2\" -> [\"match\" -> \"12\", \"position\" -> {4, 5}], \"3\" -> [\"match\" -> \"1999\", \"position\" -> {7, 10}]], [\"0\" -> [\"match\" -> \"01/21/1952\", \"position\" -> {30, 39}], \"1\" -> [\"match\" -> \"01\", \"position\" -> {30, 31}], \"2\" -> [\"match\" -> \"21\", \"position\" -> {33, 34}], \"3\" -> [\"match\" -> \"1952\", \"position\" -> {36, 39}]]}", "", "Explode a string (albeit a contrived example):", ";;ret = {}; for x in (pcre_match(\"This is a string of words, with punctuation, that should be exploded. By space. --zippy--\", \"[a-zA-Z]+\", 0, 1)) ret = {@ret, x[\"0\"][\"match\"]}; endfor return ret;", "=> {\"This\", \"is\", \"a\", \"string\", \"of\", \"words\", \"with\", \"punctuation\", \"that\", \"should\", \"be\", \"exploded\", \"By\", \"space\", \"zippy\"}"}
110 .pcre_replace() glorp rc {"Syntax: pcre_replace (STR <subject>, STR <pattern>) => STR", "", "The function `pcre_replace()' replaces <subject> with replacements found in <pattern> using PCRE2 regular expressions.", "", "The pattern string has a specific format that must be followed, which should be familiar if you have used the likes of Vim, Perl, or sed. The string is composed of four elements, each separated by a delimiter (typically a slash (/) or an exclamation mark (!)), that tell the regular expression engine how to parse your replacement. We'll break the string down and mention relevant options below:", "", "1. Type of search to perform. In MOO, only 's' is valid. This parameter is kept for the sake of consistency.", "2. The regular expression pattern to match.", "3. The replacement text to substitute for each match.", "4. Optional modifiers:", " g: Global. This will replace all occurrences in your string rather than stopping at the first.", " i: Case-insensitive. Uppercase, lowercase, it doesn't matter. All will be replaced.", " ", "The replacement text can use placeholders in the form of a dollar sign and a number corresponding to a capture group (e.g. $1 will be replaced with the text from the first capture group, $2 the second, etc).", "", "Examples:", "", "Replace one word with another:", "pcre_replace(\"I like banana pie. Do you like banana pie?\", \"s/banana/apple/g\")", "=> \"I like apple pie. Do you like apple pie?\"", "", "Replace text from a capture group:", ";pcre_replace(\"You can find it in objref #1234.\", \"s/objref (#\\d*)/object $1/g\")", "=> \"You can find it in object #1234.\"", "", "If you find yourself wanting to replace a string that contains slashes, it can be useful to change your delimiter to an exclamation mark:", "pcre_replace(\"Unix, wow! /bin/bash is a thing.\", \"s!/bin/bash!/bin/fish!g\")", "=> \"Unix, wow! /bin/fish is a thing.\""}
111 .random_bytes() glorp rc {"Syntax: random_bytes (INT count)", "", "Returns a binary string composed of between one and 10000 random bytes. count specifies the number of bytes and must be a positive integer; otherwise, E_INVARG is raised. "}
112 .read_http() glorp rc {"Syntax: read_http (request-or-response [, OBJ conn])", "", "Reads lines from the connection conn (or, if not provided, from the player that typed the command that initiated the current task) and attempts to parse the lines as if they are an HTTP request or response. request-or-response must be either the string \"request\" or \"response\". It dictates the type of parsing that will be done.", "", "Just like read(), if conn is provided, then the programmer must either be a wizard or the owner of conn; if conn is not provided, then read_http() may only be called by a wizard and only in the task that was last spawned by a command from the connection in question. Otherwise, E_PERM is raised. Likewise, if conn is not currently connected and has no pending lines of input, or if the connection is closed while a task is waiting for input but before any lines of input are received, then read_http() raises E_INVARG.", "", "If parsing fails because the request or response is syntactically incorrect, read_http() will return a map with the single key \"error\" and a list of values describing the reason for the error. If the queued input cannot be decoded as a valid MOO binary string, read_http() returns 0. If parsing succeeds, read_http() will return a map with an appropriate subset of the following keys, with values parsed from the HTTP request or response: \"method\", \"uri\", \"headers\", \"body\", \"status\" and \"upgrade\".", "", " Fine point: read_http() assumes the input strings are binary strings. When called interactively, as in the example below, the programmer must insert the literal line terminators or parsing will fail. ", "", "The following example interactively reads an HTTP request from the players connection.", "", "read_http(\"request\", player)", "GET /path HTTP/1.1~0D~0A", "Host: example.com~0D~0A", "~0D~0A", "", "In this example, the string ~0D~0A ends the request. The call returns the following (the request has no body):", "", "[\"headers\" -> [\"Host\" -> \"example.com\"], \"method\" -> \"GET\", \"uri\" -> \"/path\"]", "", "The following example interactively reads an HTTP response from the players connection.", "", "read_http(\"response\", player)", "HTTP/1.1 200 Ok~0D~0A", "Content-Length: 10~0D~0A", "~0D~0A", "1234567890", "", "The call returns the following:", "", "[\"body\" -> \"1234567890\", \"headers\" -> [\"Content-Length\" -> \"10\"], \"status\" -> 200]"}
113 .recreate() glorp rc {"Syntax: recreate(OBJ <old>, OBJ <parent> [, OBJ <owner>]) => OBJ", "", "Recreate invalid object <old> (one that has previously been recycle()ed) as <parent>, optionally owned by <owner>. This has the effect of filling in holes created by recycle() that would normally require renumbering and resetting the maximum object.", "", "The normal rules apply to parent and owner. You either have to own <parent>, <parent> must be fertile, or you have to be a wizard. Similarly, to change <owner>, you should be a wizard. Otherwise it's superfluous."}
114 .recycled_objects() glorp rc {"Syntax: recycled_objects() => LIST", "", "Return a list of all invalid objects in the database. An invalid object is one that has been destroyed with the recycle() function."}
115 .relative_heading() glorp rc {"Syntax: relative_heading(LIST from, LIST to) => LIST", "", "Returns {horizontal-heading, vertical-heading} from one three-dimensional point to another. Both lists must contain three floating-point numbers; otherwise E_TYPE is raised."}
116 .remove_ansi() glorp rc {"Syntax: remove_ansi(STR string) => STR", "", "Removes ToastStunt ANSI tags from string without replacing them with ANSI escape sequences."}
117 .reseed_random() glorp rc {"Syntax: reseed_random()", "", "Provide a new seed to the pseudo random number generator."}
118 .respond_to() glorp rc {"Syntax: respond_to(OBJ object, STR verb)", "", "Returns true if <verb> is callable on <object>, taking into account inheritance, wildcards (star verbs), etc. Otherwise, returns false. If the caller is permitted to read the object (because the object's `r' flag is true, or the caller is the owner or a wizard) the true value is a list containing the object number of the object that defines the verb and the full verb name(s). Otherwise, the numeric value `1' is returned."}
119 .reverse() glorp rc {"Syntax: reverse(LIST|STR <value>) => LIST | STR", "", "Return a reversed list or string. If <value> is neither a list nor a string, E_INVARG is raised.", "", "Examples:", "", ";reverse({1,2,3,4}) => {4,3,2,1}", ";reverse(\"asdf\") => \"fdsa\"", ""}
120 .rindex() glorp rc {"*forward*", "index()"}
121 .round() glorp rc {"Syntax: round(FLOAT x) => FLOAT", "", "Returns x rounded to the nearest integer value, as a floating-point number."}
122 .run_gc() glorp rc {"Syntax: run_gc() => NONE", "", "Requests a garbage-collection pass. This function is available only when ToastStunt is built with garbage collection enabled. If the programmer is not a wizard, then E_PERM is raised."}
123 .salt() glorp rc {"Syntax: salt (STR format, STR input)", "", "Generate a crypt() compatible salt string for the specified salt format using the specified binary random input. The specific set of formats supported depends on the libraries used to build the server, but will always include the standard salt format, indicated by the format string \"\" (the empty string), and the BCrypt salt format, indicated by the format string \"$2a$NN$\" (where \"NN\" is the work factor). Other possible formats include MD5 (\"$1$\"), SHA256 (\"$5$\") and SHA512 (\"$6$\"). Both the SHA256 and SHA512 formats support optional rounds.", "", "salt(\"\", \".M\") => \"iB\"", "salt(\"$1$\", \"~183~1E~C6/~D1\") => \"$1$MAX54zGo\"", "salt(\"$5$\", \"x~F2~1Fv~ADj~92Y~9E~D4l~C3\") => \"$5$s7z5qpeOGaZb\"", "salt(\"$5$rounds=2000$\", \"G~7E~A7~F5Q5~B7~0Aa~80T\") => \"$5$rounds=2000$5trdp5JBreEM\"", "salt(\"$6$\", \"U7~EC!~E8~85~AB~CD~B5+~E1?\") => \"$6$JR1vVUSVfqQhf2yD\"", "salt(\"$6$rounds=5000$\", \"~ED'~B0~BD~B9~DB^,\\\\~BD~E7\") => \"$6$rounds=5000$hT0gxavqSl0L\"", "salt(\"$2a$08$\", \"|~99~86~DEq~94_~F3-~1A~D2#~8C~B5sx\") => \"$2a$08$dHkE1lESV9KrErGhhJTxc.\"", "", "Note: To ensure proper security, the random input must be from a sufficiently random source. "}
124 .server_log() glorp rc {"Syntax: server_log (STR message [, INT level]) => NONE", "", "The text in message is sent to the server log with a distinctive prefix (so that it can be distinguished from server-generated messages)", "", "If the programmer is not a wizard, then E_PERM is raised.", "", "If level is provided and is an integer between 0 and 7 inclusive, then message is marked in the server log as one of eight predefined types, from simple log message to error message. Otherwise, if level is provided and true, then message is marked in the server log as an error."}
125 .server_version() glorp rc {"Syntax: server_version ([<detail>]) => STR | LIST | value", "", "With no arguments, returns the server version string.", "", "With an argument that is not a string, or with an empty string, returns the full server version structure. This list includes version fields such as major, minor, release, ext, string, and os, plus grouped feature, option, make, and source information when available.", "", "With a non-empty string argument, returns the named element from the full version structure. Slash-separated paths may be used to select nested elements, such as \"features\" or \"source/vcs\".", "", "Raises E_INVARG if <detail> is a string that does not name an available version element."}
126 .set_task_local() glorp rc {"Syntax: set_task_local(ANY value)", "", "Sets a value that gets associated with the current running task. This value persists across verb calls and gets reset when the task is killed, making it suitable for securely passing sensitive intermediate data between verbs. The value can then later be retrieved using the `task_local` function.", "", "The programmer must be a wizard, or E_PERM is raised.", "", "set_task_local(\"arbitrary data\")", "set_task_local({\"list\", \"of\", \"arbitrary\", \"data\"})"}
127 .set_thread_mode() glorp rc {"Syntax: set_thread_mode() => INT", " set_thread_mode(INT <mode>) => none", "", "With no arguments specified, set_thread_mode will return the current thread mode for the verb. A value of 1 indicates that threading is enabled for functions that support it. A value of 0 indicates that threading is disabled and all functions will execute in the main MOO thread, as functions have done in default LambdaMOO since version 1.", "", "If you specify an argument, you can control the thread mode of the current verb. A <mode> of 1 will enable threading and a <mode> of 0 will disable it. This form returns no value. You can invoke this function multiple times if you want to disable threading for a single function call and enable it for the rest.", "", "When should you disable threading? In general, threading should be disabled in verbs where it would be undesirable to suspend(). Each threaded function will immediately suspend the verb while the thread carries out its work. This can have a negative effect when you want to use these functions in verbs that cannot or should not suspend, like $sysobj:do_command or $sysobj:do_login_command.", "", "Note that the threading mode affects the current verb only and does NOT affect verbs called from within that verb."}
128 .shutdown() glorp rc {"Syntax: shutdown ([STR <message>] [, ANY <unclean_shutdown>]) => 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 raised.", "", "The optional <unclean_shutdown> argument controls whether the server performs a clean or unclean shutdown:", " - If 0 or not provided: The server performs a clean shutdown, saving the database normally.", " - If 1 (or any true value): The server performs an unclean shutdown (panic), dumping the database to an output_database.PANIC file instead of the normal database. <message> will be printed to the server log."}
129 .simplex_noise() glorp rc {"Syntax: simplex_noise(LIST coordinates) => FLOAT", "", "Returns simplex noise for one to four dimensions. The coordinate list must contain one, two, three, or four floating-point numbers. Non-float coordinates raise E_TYPE; unsupported dimensionality returns E_TYPE."}
130 .slice() glorp rc {"Syntax: slice(LIST <alist> [, INT | LIST | STR <index>, ANY <default map value>]) => LIST", "", "Return the <index>-th elements of <alist>. By default, index will be 1. If index is a list of integers, the returned list will have those elements from <alist>. This is the built-in equivalent of LambdaCore's $list_utils:slice verb.", "", "If <alist> is a list of maps, index can be a string indicating a key to return from each map in <alist>.", "", "If <default map value> is specified, any maps not containing the key <index> will have <default map value> returned in their place. This is useful in situations where you need to maintain consistency with a list index and can't have gaps in your return list.", "", "Examples:", " >slice({{\"z\", 1}, {\"y\", 2}, {\"x\",5}}, 2) => {1, 2, 5}.", " >slice({{\"z\", 1, 3}, {\"y\", 2, 4}}, {2, 1}) => {{1, \"z\"}, {2, \"y\"}}", " >;slice({[\"a\" -> 1, \"b\" -> 2], [\"a\" -> 5, \"b\" -> 6]}, \"a\") => {1, 5}", " >;slice({[\"a\" -> 1, \"b\" -> 2], [\"a\" -> 5, \"b\" -> 6], [\"b\" -> 8]}, \"a\", 0) => {1, 5, 0}"}
131 .sort() glorp rc {"Syntax: sort(LIST <list> [, LIST <keys>, INT <natural sort order?>, INT <reverse>]) => LIST", "", "Sorts <list> either by <keys> or using the list itself. When sorting <list> by itself, you can use an empty list ({}) for <keys> to specify additional optional arguments.", "", "When sorting by a non-empty keys list, the keys list must be the same length as <list>, or E_INVARG is raised. The values used for sorting must be homogeneous scalar values. Lists, maps, anonymous objects, and WAIFs cannot be sorted and raise E_TYPE.", "", "If <natural sort order> is true, strings containing multi-digit numbers will consider those numbers to be a single character. So, for instance, this means that 'x2' would come before 'x11' when sorted naturally because 2 is less than 11. This argument defaults to 0.", "", "If <reverse> is true, the sort order is reversed. This argument defaults to 0.", "", "Examples:", "", "Sort a list by itself:", ">;sort({\"a57\", \"a5\", \"a7\", \"a1\", \"a2\", \"a11\"})", "=> {\"a1\", \"a11\", \"a2\", \"a5\", \"a57\", \"a7\"}", "", "Sort a list by itself with natural sort order:", ">;sort({\"a57\", \"a5\", \"a7\", \"a1\", \"a2\", \"a11\"}, {}, 1)", "=> {\"a1\", \"a2\", \"a5\", \"a7\", \"a11\", \"a57\"}", "", "Sort a list of strings by a list of numeric keys:", ">;sort({\"foo\", \"bar\", \"baz\"}, {123, 5, 8000})", "=> {\"bar\", \"foo\", \"baz\"}"}
132 .spellcheck() glorp rc {"Syntax: spellcheck(STR <word>) => INT or LIST", "", "This function checks the English spelling of <word>. If the spelling is correct, the function will return a 1. If the spelling is incorrect, a LIST of suggestions for correct spellings will be returned instead. If the spelling is incorrect and no suggestions can be found, an empty LIST is returned."}
133 .sqlite_close() glorp rc {"Syntax: sqlite_close(INT <database handle>) => none", "", "This function will close an open database. The programmer must be a wizard, or E_PERM is raised.", "", "E_INVARG is raised if the handle is invalid. E_PERM is raised if the handle still has worker threads using it."}
134 .sqlite_execute() glorp rc {"Syntax: sqlite_execute(INT <database handle>, STR <SQL prepared statement query>, LIST <values>) => [LIST or STR]", "", "This function will attempt to create and execute the prepared statement query given in <query> on the database referred to by <handle> with the values <values>. The programmer must be a wizard, or E_PERM is raised.", "", "On success, this function will return a list identifying the returned rows. If the query didn't return rows but was successful, an empty list is returned.", "", "If the query fails, a string will be returned identifying the SQLite error message. If <handle> is invalid, E_INVARG is returned.", "", "sqlite_execute uses prepared statements, so it's the preferred function to use for security and performance reasons.", "", "Example:", "sqlite_execute(0, \"INSERT INTO users VALUES (?, ?, ?);\", {#7, \"lisdude\", \"Albori Sninvel\"})"}
135 .sqlite_handles() glorp rc {"Syntax: sqlite_handles() => LIST", "", "Returns a list of open SQLite database handles. The programmer must be a wizard, or E_PERM is raised."}
136 .sqlite_info() glorp rc {"Syntax: sqlite_info(INT <database handle>) => MAP", "", "This function returns a map of information about the database at <handle>. The programmer must be a wizard, or E_PERM is raised.", "", "The returned map contains these keys: path, parse_types, parse_objects, sanitize_strings, and locks.", "", "E_INVARG is raised if the handle is invalid."}
137 .sqlite_interrupt() glorp rc {"Syntax: sqlite_interrupt(INT <database handle>)", "", "This function causes any pending database operation to abort at its earliest opportunity. The programmer must be a wizard, or E_PERM is raised. E_INVARG is raised if the handle is invalid. If the operation is nearly finished when sqlite_interrupt is called, it might not have an opportunity to be interrupted and could continue to completion.", "", "This can be useful when you execute a long-running query and want to abort it.", "", "NOTE: As of this writing (server version 2.7.0) the @kill command WILL NOT abort operations taking place in a helper thread. If you want to interrupt an SQLite query, you must use sqlite_interrupt and NOT the @kill command."}
138 .sqlite_last_insert_row_id() glorp rc {"Syntax: sqlite_last_insert_row_id(INT <database handle>)", "", "This function identifies the row ID of the last insert command executed on the database. The programmer must be a wizard, or E_PERM is raised. E_INVARG is raised if the handle is invalid."}
139 .sqlite_limit() glorp rc {"Syntax: sqlite_limit(INT <database handle>, STR|INT <category>, INT <new value>) => INT", "", "This function allows you to specify various construct limitations on a per-database basis. The programmer must be a wizard, or E_PERM is raised.", "", "If <new value> is a negative number, the limit is unchanged. Each limit category has a hardcoded upper bound. Attempts to increase a limit above its hard upper bound are silently truncated to the hard upper bound.", "", "Regardless of whether or not the limit was changed, the sqlite_limit() function returns the prior value of the limit. Hence, to find the current value of a limit without changing it, simply invoke this interface with the third parameter set to -1.", "", "Category may be either a string limit name or the corresponding integer SQLite limit category. E_INVARG is raised if the handle is invalid or the category is not recognized.", "", "As of this writing, the following limits exist:", "", "LIMIT_LENGTH", " The maximum size of any string or BLOB or table row, in bytes.", "", "LIMIT_SQL_LENGTH", " The maximum length of an SQL statement, in bytes.", "", "LIMIT_COLUMN", " The maximum number of columns in a table definition or in the result set of a SELECT or the maximum number of columns in an index or in an ORDER BY or GROUP BY clause.", "", "LIMIT_EXPR_DEPTH", " The maximum depth of the parse tree on any expression.", "", "LIMIT_COMPOUND_SELECT", " The maximum number of terms in a compound SELECT statement.", "", "LIMIT_VDBE_OP", " The maximum number of instructions in a virtual machine program used to implement an SQL statement. If sqlite3_prepare_v2() or the equivalent tries to allocate space for more than this many opcodes in a single prepared statement, an SQLITE_NOMEM error is returned.", "", "LIMIT_FUNCTION_ARG", " The maximum number of arguments on a function.", "", "LIMIT_ATTACHED", " The maximum number of attached databases.", "", "LIMIT_LIKE_PATTERN_LENGTH", " The maximum length of the pattern argument to the LIKE or GLOB operators.", "", "LIMIT_VARIABLE_NUMBER", " The maximum index number of any parameter in an SQL statement.", "", "LIMIT_TRIGGER_DEPTH", " The maximum depth of recursion for triggers.", "", "LIMIT_WORKER_THREADS", " The maximum number of auxiliary worker threads that a single prepared statement may start.", "", "For an up-to-date list of limits, see the SQLite documentation here: https://www.sqlite.org/c3ref/c_limit_attached.html"}
140 .sqlite_open() glorp rc {"Syntax: sqlite_open(STR <path to database>, [INT options]) => INT", "", "The function `sqlite_open' will attempt to open the database at <path> for use with SQLite. The programmer must be a wizard, or E_PERM is raised.", "", "The second argument is a bitmask of options. Options are:", "", " SQLITE_PARSE_OBJECTS [4]: Determines whether strings beginning with a pound symbol (#) are interpreted as MOO object numbers or not.", " The default is true, which means that any queries that would return a string (such as \"#123\") will be returned as objects.", " SQLITE_PARSE_TYPES [2]: If unset, no parsing of rows takes place and only strings are returned.", " SQLITE_SANITIZE_STRINGS [8]: If set, newlines (\\n) are converted into tabs (\\t) to avoid corrupting the MOO database. Default is unset.", "", "NOTE: If the MOO doesn't support bitmasking, you can still specify options. You'll just have to manipulate the int yourself. e.g. if you want to parse objects and types, arg[2] would be a 6. If you only want to parse types, arg[2] would be 2.", "", "If successful, the function will return the numeric handle for the open database.", "", "E_QUOTA is raised if too many handles are open. E_INVARG is raised if the path is invalid or the database is already open; duplicate-open errors include the existing handle as the error value. If SQLite cannot open the database, E_NONE is raised with the SQLite error message."}
141 .sqlite_query() glorp rc {"Syntax: sqlite_query(INT <database handle>, STR <database query>[, INT <show columns>]) => [LIST or STR]", "", "This function will attempt to execute the query given in <query> on the database referred to by <handle>. The programmer must be a wizard, or E_PERM is raised.", "", "On success, this function will return a list identifying the returned rows. If the query didn't return rows but was successful, an empty list is returned.", "", "If the query fails, a string will be returned identifying the SQLite error message. If <handle> is invalid, E_INVARG is returned.", "", "If <show columns> is true, the return list will include the name of the column before its results.", "", "WARNING: sqlite_query does NOT use prepared statements and should NOT be used on queries that contain user input."}
142 .string_hmac() glorp rc {"*forward*", "binary_hmac"}
143 .strtr() glorp rc {"Syntax: strtr (STR source, STR str1, STR str2 [, case-matters])", "", "Transforms the string source by replacing the characters specified by str1 with the corresponding characters specified by str2. All other characters are not transformed. If str2 has fewer characters than str1 the unmatched characters are simply removed from source. By default the transformation is done on both upper and lower case characters no matter the case. If case-matters is provided and true, then case is treated as significant.", "", "strtr(\"foobar\", \"o\", \"i\") => \"fiibar\"", "strtr(\"foobar\", \"ob\", \"bo\") => \"fbboar\"", "strtr(\"foobar\", \"\", \"\") => \"foobar\"", "strtr(\"foobar\", \"foba\", \"\") => \"r\"", "strtr(\"5xX\", \"135x\", \"0aBB\", 0) => \"BbB\"", "strtr(\"5xX\", \"135x\", \"0aBB\", 1) => \"BBX\"", "strtr(\"xXxX\", \"xXxX\", \"1234\", 0) => \"4444\"", "strtr(\"xXxX\", \"xXxX\", \"1234\", 1) => \"3434\""}
144 .suspend() glorp rc {"Syntax: suspend([INT|FLOAT seconds]) => VALUE", "", "Suspends the current task, and resumes it after at least <seconds> seconds. Sub-second suspend (IE: 0.1) is possible. (If <seconds> is not provided, the task is suspended indefinitely; such a task can only be resumed by use of the `resume()' function.) 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 raised. `Suspend()' returns zero unless it was resumed via `resume()' in which case it returns the second argument given to that function.", "", "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 raise E_PERM in that task. For more details, see the description of `read()'.", "", "By default, there is no limit to the number of tasks any player may suspend, but such a limit can be imposed from within the database. See the chapter in the ToastStunt Programmers Manual on server assumptions about the database for details."}
145 .switch_player() glorp rc {"Syntax: switch_player(OBJ <object1>, OBJ <object2> [, INT <silent>])", "", "Silently switches the player associated with this connection from <object1> to <object2>. <object1> must be connected and <object2> must be a player. This can be used in do_login_command() verbs that read or suspend (which prevents the normal player selection mechanism from working.", "", "If <silent> is true, no connection messages will be printed.", "", "The programmer must be a wizard, or E_PERM is raised. E_INVARG is raised if <object1> and <object2> are the same object, if <object1> is not connected, if <object2> is not a player, or if <object1> has no task queue to transfer."}
146 .task_local() glorp rc {"Syntax: task_local ()", "", "Returns the value associated with the current task. The value is set with the `set_task_local` function.", "", "The programmer must be a wizard, or E_PERM is raised."}
147 .task_perms() glorp rc {"Syntax: task_perms() => OBJ", "", "Returns the permissions in use by the currently-executing task."}
148 .thread_pool() glorp rc {"Syntax: thread_pool(STR <function>, STR <pool> [, INT <value>])", "", "This function allows you to control any thread pools that the server created at startup. It should be used with care, as it has the potential to create disasterous consequences if used incorrectly.", "", "The <function> parameter is the function you wish to perform on the thread pool. The functions available are:", "", " INIT: Control initialization of a thread pool.", "", " ", "The <pool> parameter controls which thread pool you wish to apply the designated function to. At the time of writing, the server creates the following thread pool:", "", " MAIN: The main thread pool where threaded built-in function work takes place.", "", "", "Finally, <value> is the value you want to pass to the <function> of <pool>. The following functions accept the following values:", "", " INIT: The number of threads to spawn. NOTE: When executing this function, the existing <pool> will be destroyed and a new one created in its place.", "", "", "Examples:", ";thread_pool(\"INIT\", \"MAIN\", 1) => Replace the existing main thread pool with a new pool consisting of a single thread."}
149 .threads() glorp rc {"Syntax: threads() => LIST", "", "When one or more MOO processes are suspended and working in a separate thread, this function returns a LIST of handlers to those threads."}
150 .toaststunt-index() glorp rc {"*index*", "Stunt / ToastStunt Functions"}
151 .typeof() glorp rc {"Syntax: typeof (value) => INT", "", "Takes any MOO value and returns an integer representing the type of value.", "", "The result is the same as the initial value of one of these built-in variables: INT, FLOAT, STR, LIST, MAP, OBJ, or ERR, BOOL, MAP, WAIF, ANON. ", "", "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."}
152 .unlisten() glorp rc {"Syntax: unlisten (ANY <canon> [, INT <ipv6>]) => none", "", "Stops listening for connections on the point described by <canon>, which should match the `port' value from an element of the list returned by listeners().", "", "If <ipv6> is provided and true, ToastStunt looks for an IPv6 listener with that description.", "", "Raises E_PERM if the programmer is not a wizard. Raises E_INVARG if there is no listener with that description."}
153 .url_decode() glorp rc {"Syntax: url_decode(STR string) => STR", "", "Returns a decoded copy of string. If outbound networking is disabled at runtime, then E_PERM is raised. If ToastStunt was built without curl support, this function is not available."}
154 .url_encode() glorp rc {"Syntax: url_encode(STR string) => STR", "", "Returns string with characters escaped for use in a URL. If outbound networking is disabled at runtime, then E_PERM is raised. If ToastStunt was built without curl support, this function is not available."}
155 .usage() glorp rc {"Syntax: usage () => LIST", "", "Return statistics concerning the server the MOO is running on. The result is a list in the following format:", "", "{load averages}, user time, system time, page reclaims, page faults, block input ops, block output ops, voluntary context switches, involuntary context switches, signals received"}
156 .value_hmac() glorp rc {"Syntax: value_hmac (value, STR key [, STR algo [, binary]])", "", "Returns the same string as string_hmac(toliteral(value), key, ...); see the description of string_hmac() for details. "}
157 .verb_args() glorp rc {"Syntax: verb_args (OBJ <object>, STR|INT <verb-name>) => LIST", " set_verb_args (OBJ <object>, STR|INT <verb-name>, LIST <args>) => none", "", "BE AWARE: verb-name can be the string name of the verb OR the index from verbs()", "", "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 raised. If <object> does not define a verb named <verb-name>, then E_VERBNF is raised. If the programmer does not have read (write) permission on the verb in question, then `verb_args()' (`set_verb_args()') raises 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()' raises 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\"})"}
158 .verb_cache_stats() glorp rc {"Syntax: verb_cache_stats() => LIST", " log_cache_stats() => NONE", "", "The server caches verbname-to-program lookups to improve performance. These functions respectively return or write to the server log file the current cache statistics. For verb_cache_stats the return value will be a list of the form", "", "{hits, negative_hits, misses, table_clears, histogram},", "", "though this may change in future server releases. The cache is invalidated by any builtin function call that may have an effect on verb lookups (e.g., delete_verb())."}
159 .verb_code() glorp rc {"Syntax: verb_code (OBJ <object>, STR|INT <verb-name> [, <fully-paren> [, <indent>]]) => LIST", " set_verb_code (OBJ <object>, STR|INT <verb-name>, LIST <code>) => LIST", "", "BE AWARE: verb-name can be the string name of the verb OR the index from verbs()", "", "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 raised. If <object> does not define a verb named <verb-name>, then E_VERBNF is raised. If the programmer does not have read (write) permission on the verb in question, then `verb_code()' (`set_verb_code()') raises E_PERM. If the programmer is not, in fact, a programmer, then E_PERM is raised.", "", "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."}
160 .verb_info() glorp rc {"Syntax: verb_info (OBJ <object>, STR|INT <verb-name>) => LIST", " set_verb_info (OBJ <object>, STR|INT <verb-name>, LIST <info>) => none", "", "BE AWARE: verb-name can be the string name of the verb OR the index from verbs()", "", "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 raised. If <object> does not define a verb named <verb-name>, then E_VERBNF is raised. If the programmer does not have read (write) permission on the verb in question, then `verb_info()' (`set_verb_info()') raises 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 raises E_INVARG if <owner> is not valid, if <perms> contains any illegal characters, or if <names> is the empty string or consists entirely of spaces; it raises E_PERM if <owner> is not the programmer and the programmer is not a wizard."}
161 .waif_stats() glorp rc {"Syntax: waif_stats() => MAP", "", "Returns a MAP of statistics about instantiated waifs. Each waif class will be a key in the MAP and its value will be the number of waifs of that class currently instantiated. Additionally, there is a `total' key that will return the total number of instantiated waifs, and a `pending_recycle' key that will return the number of waifs that have been destroyed and are awaiting the call of their :recycle verb."}
162 .yin() glorp rc {"Syntax: yin([INT <time>, INT <minimum ticks>, INT <minimum seconds>] ) => INT", "", "Suspend the current task if it's running out of ticks or seconds. This is meant to provide similar functionality to the LambdaCore-based suspend_if_needed verb or manually specifying something like: ticks_left() < 2000 && suspend(0)", "", "Time: How long to suspend the task. Default: 0", "Minimum ticks: The minimum number of ticks the task has left before suspending.", "Minimum seconds: The minimum number of seconds the task has left before suspending."}