Introduction to Squirrel#
Squirrel is a programming language used in Titanfall 2 and Northstar mods, it is worth noting that the version of squirrel used by titanfall appears to be a modified version of the language, based on version 2.3.0
File format#
All files using squirrel are saved as .nut or .gnut
when creating mods your mod will typically be a series of functions and callbacks
Squirrel as a typed language#
All variables and functions in squirrel must have a type defined on declaration
function dosomething()
is not acceptable and should instead be
void function dosomething()
Similarly when declaring a variable
funnynumber = 69
will not work, instead use:
int funnynumber = 69
Variable types#
void: can be used to define functions that do not return a value, but still do things. most of your functions will be voidinteger: a whole numberfloat: any floating-point number.string: text. Squirrel does not have native chars, so calling an index of a string will return a number in standart ascii format. e.g. “a”[0] = 97entity: an entity and all its associated informationbool:trueorfalse(Squirrel treatsnulland0as false and every other number or object that’s!= nullas true)array: an ordered list of items indexed from 0, increasing with the number of items such as: 0:”hello”,1:1000,2:entity playertable: a list of items with indexes defined on object entry such as:"word":"hello","kilo":1000","pilot":entity player.You have to create new slots with the<-operator and overwrite values in slots with=. Tables are explained in more detail in the squirrel documentationstruct: a series of attributes assigned to a structure and accessed through withstructname.variablenamevar: Var typically refers to variables that lack any stated type, this will cause issues with many functions unless you use theuntypedidentifier at the start of your file, or if you useexpect type(variable)when passing the variable to that function