NUT & GNUT-Squirrel游戏语言
关于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.
This explains a version of Squirrel suspected to be modified by Respawn. To learn about Squirrel for other, non-Respawn games, check Squirrel - Valve Developer Community.
变量
A Varaible can be declared by specifying it's type, then it's name, an equals sign, then it's value, like so:
Then, it can be used by typing it's name.
数据类型
There are multiple base data types for Squirrel, and some data types from source.
数据类型
解释
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.
函数和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 are used either as a class alternative or for grouping variables in a singleton method.
Declaring example:
Last updated