Name | Returns | Usage | Ver | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
log | string | log([level,] value [,value])
3.11
| add a line of text to the server and/or system log, values are typically string constants or variables, level is the debug level/priority (default: LOG_INFO)
| read | string | read([count])
| 3.11
| read up to count characters from input stream
| readln | string | readln([count])
| 3.11
| read a single line, up to count characters, from input stream
| write | void | write(value [,value])
| 3.11
| send one or more values (typically strings) to the server output
| write_raw | void | write_raw(value [,value])
| 3.14
| send a stream of bytes (possibly containing NULLs or special control code sequences) to the server output
| writeln | void | writeln(value [,value])
| 3.11
| send a line of text to the console or event log with automatic line termination (CRLF), values are typically string constants or variables (AKA print)
| printf | string | printf(string format [,value][,value])
| 3.10
| print a formatted string - CAUTION: for experienced C programmers ONLY
| alert | void | alert(value)
| 3.10
| print an alert message (ala client-side JS)
| prompt | string | prompt([text] [,value] [,mode=K_EDIT])
| 3.10
| displays a prompt (text) and returns a string of user input (ala client-side JS)
| confirm | boolean | confirm(value)
| 3.10
| displays a Yes/No prompt and returns true or false based on user's confirmation (ala client-side JS, true = yes)
| deny | boolean | deny(value)
| 3.15b
| displays a No/Yes prompt and returns true or false based on user's denial (true = no)
| exit | void | exit([exit_code])
| 3.11
| stop script execution, optionally setting the global property exit_code to the specified numeric value
| load | undefined | load([bool background or object scope,] string filename [,args])
| 3.12
| load and execute a JavaScript module (filename), optionally specifying a target scope object (default: this) and a list of arguments to pass to the module (as argv). Returns the result (last executed statement) of the executed script or a newly created Queue object if background is true). | Background (added in v3.12): If background is true, the loaded script runs in the background (in a child thread) but may communicate with the parent script/thread by reading from and/or writing to the parent_queue (an automatically created Queue object). The result (last executed statement) of the executed script (or the optional exit_code passed to the exit() function) will be automatically written to the parent_queue which may be read later by the parent script (using load_result.read(), for example). require | undefined | require([object scope,] string filename, propname [,args])
| 3.17
| load and execute a JavaScript module (filename), optionally specifying a target scope object (default: this) and a list of arguments to pass to the module (as argv) IF AND ONLY IF the property named propname is not defined in the target scope (a defined symbol with a value of undefined will not cause the script to be loaded). Returns the result (last executed statement) of the executed script or null if the script is not executed.
| mswait | number | mswait([milliseconds=1])
| 3.13
| millisecond wait/sleep routine (AKA sleep), returns number of elapsed clock ticks (in v3.13)
| yield | void | yield([forced=true])
| 3.11
| release current thread time-slice, a forced yield will yield to all other pending tasks (lowering CPU utilization), a non-forced yield will yield only to pending tasks of equal or higher priority. forced defaults to true
| random | number | random(max_number=100)
| 3.10
| return random integer between 0 and max_number-1
| time | number | time()
| 3.10
| return current time and date in Unix (time_t) format (number of seconds since Jan-01-1970)
| beep | void | beep([frequency=500] [,duration=500])
| 3.10
| produce a tone on the local speaker at specified frequency for specified duration (in milliseconds)
| sound | boolean | sound([filename])
| 3.10
| play a waveform (.wav) sound file (currently, on Windows platforms only)
| ctrl | string | ctrl(number or string)
| 3.11
| return ASCII control character representing character passed - Example: ctrl('C') returns ''
| ascii | undefined | ascii([string text] or [number value])
| 3.10
| convert single character to numeric ASCII value or vice-versa (returns number OR string)
| ascii_str | string | ascii_str(text)
| 3.10
| convert extended-ASCII (CP437) characters in text string to plain US-ASCII equivalent, returns modified string
| strip_ctrl | string | strip_ctrl(text)
| 3.10
| strip control characters from string, returns modified string
| strip_ansi | string | strip_ansi(text)
| 3.18c
| strip all ANSI terminal control sequences from string, returns modified string
| strip_exascii | string | strip_exascii(text)
| 3.10
| strip all extended-ASCII characters from string, returns modified string
| skipsp | string | skipsp(text)
| 3.15
| skip (trim) white-space characters off beginning of string, returns modified string
| truncsp | string | truncsp(text)
| 3.10
| truncate (trim) white-space characters off end of string, returns modified string
| truncstr | string | truncstr(text, charset)
| 3.10
| truncate (trim) string at first char in charset, returns modified string
| lfexpand | string | lfexpand(text)
| 3.10
| expand line-feeds (LF) to carriage-return/line-feeds (CRLF), returns modified string
| wildmatch | boolean | wildmatch([case_sensitive=false,] string [,pattern='*'] [,path=false])
| 3.14
| returns true if the string matches the wildcard pattern (wildcards supported are '*' and '?'), if path is true, '*' will not match path delimeter characters (e.g. '/')
| backslash | string | backslash(path)
| 3.12
| returns directory path with trailing (platform-specific) path delimeter (i.e. "slash" or "backslash")
| fullpath | string | fullpath(path)
| 3.15
| Creates an absolute or full path name for the specified relative path name.
| file_getname | string | file_getname(path/filename)
| 3.11
| returns filename portion of passed path string
| file_getext | string | file_getext(path/filename)
| 3.11
| returns file extension portion of passed path/filename string (including '.') or undefined if no extension is found
| file_getcase | string | file_getcase(path/filename)
| 3.11
| returns correct case of filename (long version of filename on Windows) or undefined if the file doesn't exist
| file_cfgname | string | file_cfgname(path, filename)
| 3.12
| returns completed configuration filename from supplied path and filename, optionally including the local hostname (e.g. path/file.host.domain.ext or path/file.host.ext) if such a variation of the filename exists
| file_getdosname | string | file_getdosname(path/filename)
| 3.15
| returns DOS-compatible (Micros~1 shortened) version of specified path/filename(on Windows only) | returns unmodified path/filename on other platforms file_exists | boolean | file_exists(path/filename)
| 3.10
| verify a file's existence
| file_remove | boolean | file_remove(path/filename)
| 3.10
| delete a file
| file_removecase | boolean | file_removecase(path/filename)
| 3.14
| delete files case insensitively
| file_rename | boolean | file_rename(path/oldname, path/newname)
| 3.11
| rename a file, possibly moving it to another directory in the process
| file_copy | boolean | file_copy(path/source, path/destination)
| 3.11
| copy a file from one directory or filename to another
| file_backup | boolean | file_backup(path/filename [,level=5] [,rename=false])
| 3.11
| backup the specified filename as filename.number.extension where number is the backup number 0 through level-1 (default backup level is 5), if rename is true, the original file is renamed instead of copied (default is false)
| file_isdir | boolean | file_isdir(path/filename)
| 3.10
| check if specified filename is a directory
| file_attrib | number | file_attrib(path/filename)
| 3.10
| get a file's attributes (same as file_mode() on *nix). On Windows, the return value corresponds with _finddata_t.attrib (includes DOS/Windows file system-specific attributes, like hidden, and archive). Returns -1 if the path/filename does not exist.
| file_mode | number | file_mode(path/filename)
| 3.17c
| get a file's type and mode flags (e.g. read/write/execute permissions). The return value corresponds with struct stat.st_mode. Returns -1 if the path/filename does not exist.
| file_chmod | number | file_chmod(path/filename, number mode)
| 3.17c
| set a file's permissions flags. The supported mode bit values are system-dependent (e.g. Windows only supports setting or clearing the user-write/0x80 mode flag). Returns true if the requested change was successful.
| file_date | number | file_date(path/filename)
| 3.10
| get a file's last modified date/time (in time_t format). Returns -1 if the path/filename does not exist.
| file_cdate | number | file_cdate(path/filename)
| 3.17
| get a file's creation date/time (in time_t format). Returns -1 if the path/filename does not exist.
| file_size | number | file_size(path/filename)
| 3.10
| get a file's length (in bytes). Returns -1 if the path/filename does not exist.
| file_utime | boolean | file_utime(path/filename [,access_time=current] [,mod_time=current])
| 3.11
| change a file's last accessed and modification date/time (in time_t format), or change to current time
| file_touch | boolean | file_touch(path/filename)
| 3.11
| updates a file's last modification date/time to current time, creating an empty file if it doesn't already exist
| file_mutex | boolean | file_mutex(path/filename [,text=local_hostname] [,max_age=0])
| 3.12
| attempts to create an mutual-exclusion (e.g. lock) file, optionally with the contents of text. If a non-zero max_age (supported in v3.13b+) is specified and the lock file exists, but is older than this value (in seconds), it is presumed stale and removed/over-written
| file_compare | boolean | file_compare(path/file1, path/file2)
| 3.14
| compare 2 files, returning true if they are identical, false otherwise
| directory | array | directory(path/pattern [,flags=GLOB_MARK])
| 3.10
| returns an array of directory entries, pattern is the path and filename or wildcards to search for (e.g. '/subdir/*.txt'), flags is a bitfield of optional glob flags (default is GLOB_MARK)
| dir_freespace | number | dir_freespace(directory [,unit_size=1])
| 3.11
| returns the amount of available disk space in the specified directory using the specified unit_size in bytes (default: 1), specify a unit_size of 1024 to return the available space in kilobytes.
| disk_size | number | disk_size(directory [,unit_size=1])
| 3.14
| returns the total disk size of the specified directory using the specified unit_size in bytes (default: 1), specify a unit_size of 1024 to return the total disk size in kilobytes.
| socket_select | array | socket_select([array of socket objects or descriptors] [,timeout=0] [,write=false])
| 3.11
| checks an array of socket objects or descriptors for read or write ability (default is read), default timeout value is 0.0 seconds (immediate timeout), returns an array of 0-based index values into the socket array, representing the sockets that were ready for reading or writing, or null on error. If multiple arrays of sockets are passed, they are presumed to be in the order of read, write, and except. In this case, the write parameter is ignored and an object is returned instead with up to three properties "read", "write", and "except", corresponding to the passed arrays. Empty passed arrays will not have a corresponding property in the returned object.
| socket_strerror | string | socket_strerror(error)
| 3.18c
| get the description(string representation) of a numeric socket error value (e.g. socket_errno)
| strerror | string | strerror(error)
| 3.18c
| get the description(string representation) of a numeric system error value (e.g. errno)
| mkdir | boolean | mkdir(path/directory)
| 3.10
| make a directory
| mkpath | boolean | mkpath(path/directory)
| 3.15
| make a path to a directory (creating all necessary sub-directories). Returns true if the directory already exists.
| rmdir | boolean | rmdir(path/directory)
| 3.10
| remove a directory
| strftime | string | strftime(format [,time=current])
| 3.10
| return a formatted time string (ala C strftime)
| format | string | format(format [,args])
| 3.10
| return a formatted string (ala the standard C sprintf function)
| html_encode | string | html_encode(text [,ex_ascii=true] [,white_space=true] [,ansi=true] [,ctrl_a=true] [, state (object)])
| 3.11
| return an HTML-encoded text string (using standard HTML character entities), escaping IBM extended-ASCII (CP437), white-space characters, ANSI codes, and CTRL-A codes by default.Optionally storing the current ANSI state in state object
| html_decode | string | html_decode(html)
| 3.11
| return a decoded HTML-encoded text string
| word_wrap | string | word_wrap(text [,line_length=79 [, orig_line_length=79 [, handle_quotes=true [, is_utf8=false]]]])
| 3.11
| returns a word-wrapped version of the text string argument optionally handing quotes magically, line_length defaults to 79, orig_line_length defaults to 79, handle_quotes defaults to true, and is_utf8 defaults to false
| quote_msg | string | quote_msg(text [,line_length=79] [,prefix=" > "])
| 3.11
| returns a quoted version of the message text string argument, line_length defaults to 79, prefix defaults to " > "
| rot13_translate | string | rot13_translate(text)
| 3.11
| returns ROT13-translated version of text string (will encode or decode text)
| base64_encode | string | base64_encode(text)
| 3.11
| returns base64-encoded version of text string or null on error
| base64_decode | string | base64_decode(text)
| 3.11
| returns base64-decoded text string or null on error
| crc16_calc | number | crc16_calc(text)
| 3.11
| calculate and return 16-bit CRC of text string
| crc32_calc | number | crc32_calc(text)
| 3.11
| calculate and return 32-bit CRC of text string
| chksum_calc | number | chksum_calc(text)
| 3.11
| calculate and return 32-bit checksum of text string
| md5_calc | string | md5_calc(text [,hex=false])
| 3.11
| calculate and return 128-bit MD5 digest of text string, result encoded in base64 (default) or hexadecimal
| sha1_calc | string | sha1_calc(text [,hex=false])
| 3.19
| calculate and return 160-bit SHA-1 digest of text string, result encoded in base64 (default) or hexadecimal
| resolve_ip | string | resolve_ip(hostname [,array=false])
| 3.11
| resolve IP address of specified hostname (AKA gethostbyname). If array is true (added in 3.17), will return an array of all addresses rather than just the first one (upon success).
| resolve_host | string | resolve_host(ip_address)
| 3.11
| resolve hostname of specified IP address (AKA gethostbyaddr)
| netaddr_type | number | netaddr_type(email_address)
| 3.12
| returns the proper message net_type for the specified email_address, (e.g. NET_INTERNET for Internet e-mail or NET_NONE for local e-mail)
| list_named_queues | array | list_named_queues()
| 3.12
| returns an array of named queues (created with the Queue constructor)
| flags_str | undefined | flags_str([string] or [number])
| 3.13
| convert a string of security flags (letters) into their numeric value or vice-versa (returns number OR string) - (added in v3.13)
| utf8_encode | string | utf8_encode([string CP437] or [string UTF16] or [number codepoint])
| 3.17c
| returns UTF-8 encoded version of the specified CP437 text string, UTF-16 encoded text string, or a single Unicode | |