Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Definitions

Definitions can be used to simplify common patterns.

Basic Syntax

A definition can be used to type specific data patterns.

def Wait(duration: int) -> dict:
	type: 0;
	duration: duration;

Calling this definition places the resulting data where the call occurs.

SillyScript JSON

The SillyScript definition call:

def Wait(duration: int) -> dict:
	type: 0;
	duration: duration;
 
Wait(123);

The equivalent JSON:

[
	{
		"type": 0,
		"duration": 123
	}
]

Arguments

Definition arguments are provided as a list of NAME: TYPE combinations. See Types for more information on types.

Named Arguments

Arguments can also be passed by name. This allows only certain arguments to be used.

For example:

SillyScript JSON

The SillyScript definition call:

def Jump(
	height: float = 5.0,
	duration: int = 60
) -> dict:
	type: 1;
	height: height;
	duration: duration;
 
Jump(duration: 123);

The equivalent JSON:

[
	{
		"type": 1,
		"height": 5.0,
		"duration": 123
	}
]