SLUDGE

spawnSub


Syntax:

spawnSub (thisFunction);

Purpose:

Starts thisFunction while continuing the current function at the same time. The thisFunction function must take no parameters and will be started the next time the screen updates. Execution of the function containing the call to spawnSub will continue first.

Return value:

No return value.

Example:

var a;

sub init () {
   a = 10;
   spawnSub (setA);
   a = 20;

   say (ego, a);
   # The ego character will now be saying "20"
   # The init function will be paused because of the say command...
   # ...giving the spawned function chance to execute

   say (ego, a);
   # The ego character will now be saying "30"
}

sub setA () {
   a = 30;
}

See also:

Functions (subs)