Next: Sending Messages

Prev: Operators

Calling Functions

A C-- method can call a built-in function using a function call expression, which has the following syntax:

function-name(arg1, arg2, ...)
function-name is an identifier naming the function, and arg1, arg2, ... are expressions. There do not have to be any arguments, but you must include the parentheses even if there are no arguments. The arguments are evaluated from left to right.

As an example, the pad() function pads a string argument with spaces to a certain length. The following expression has the value "foo ":

pad("foo", 6);
Coldmud's built-in functions allow you to perform string and list operations, modify and retrieve information from the current object, perform administrative tasks, among other things. For descriptions of the available functions, see Function Descriptions.

For various reasons, functions can throw errors. For instance, calling a function with an incorrect number of arguments causes a ~numargs error, and calling a function with arguments of incorrect type causes a ~type error. See Errors for information on how to handle errors.