NUT & GNUT - Squirrel

About Squirrel

Squirrel is a programming language similar to Lua, but uses a C like syntax. In Source Squirrel is used as one of the scripting languages in the VScript scripting system.

Variables

A Varaible can be declared by specifying it's type, then it's name, an equals sign, then it's value, like so:

int x = 5;

Then, it can be used by typing it's name.

printt(x);

Data Types

There are multiple base data types for Squirrel, and some data types from source.

Data Type
Description

bool

A boolean value, true or false.

int

float

vector

An element with x, y, and z components.

array<T>

An array of dynamic value, of type T.

struct

A class alternative without functions, explained below.

var

Can contain anything, but cannot be used as input to functions with input types that are not 'var'.

entity

Is used for anything in the game world, except UI, which should use var, as their type is unknown.

Functions and Globalization

Functions are the primary way to execute code. All code that is not a variable deceleration must be inside a function.

Declaration example:

Structs

Structs are used either as a class alternative or for grouping variables in a singleton method.

Declaring example:

Last updated

Was this helpful?