OutOfBounds class

From m204wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

An OutOfBounds exception indicates that the stringTokenizer class AtEnd property was true when attempting to scan for a token. For example:

%t is object stringTokenizer %t = 'foobar':stringTokenizer printText {~=%t:nextToken} if %t:notAtEnd then printText {~=%t:nextToken} else print 'Safe coding technique protected against OutOfBounds exception' end if print 'Questionable technique...' printText {~=%t:nextToken}

The output from the above fragment is:

%t:nextToken=foobar Safe coding technique protected against OutOfBounds exception Questionable technique... %t:nextToken= *** 1 CANCELLING REQUEST: MSIR.0751: Class StringTokenizer, function NextToken: OutOfBounds exception: Past end of string ...

The OutOfBounds class is available as of Sirius Mods version 7.9.

The OutOfBounds methods

The following are the available OutOfBounds class methods.

MethodDescription
NewCreate a new OutOfBounds object

The methods in the class are described in the subsections that follow. In addition:

New constructor

Create a new OutOfBounds object (OutOfBounds class)

[Introduced in Sirius Mods 7.9]

This Constructor generates an instance of an OutOfBounds exception. The New method format follows:

Syntax

%outOfBounds = [%(OutOfBounds):]New

Syntax terms

%outOfBounds A reference to an instance of an OutOfBounds object.
[%(OutOfBounds):] The class name in parentheses denotes a Constructor. See Usage notes, below, for more information about invoking an OutOfBounds Constructor.

Usage notes

  • As described in Using New or other Constructors, New can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is Null:

    %outOfBoundsExc = new %outOfBoundsExc = %(OutOfBounds):new %outOfBoundsExc = %outOfBoundsExc:new