Next: Errors

Prev: Objects

Defining methods

A method in Coldmud is an object's definition of how to handle a message. Methods are written in a language called C--, which resembles C at first glance. However, C-- is a simpler language, and it stresses readability instead of conciseness.

The building blocks of methods are character sequences called tokens. From these tokens you can assemble a sequence of instructions to the interpreter called statements. You express values in statements using expressions.

Methods can return values using a return statement. If a method does not explicitly return a value, its return value is the dbref of the current object.

Methods have a limited amount of running time; if a method executes too many instructions before returning, it will abort with a ~ticks error, which it cannot catch. See Errors

Menu:

Example Method
An example C-- method
Tokens
The building blocks of methods
Method Structure
Structure of a method
Statements
Telling the interpreter what to do
Expressions
Expressing values in C--