Knight docs
EN ID
GitHub

Types & Variables

Primitive types, handles, null and type rules.

Primitive types

TypeDescription
int64-bit signed integer (decimal or 0x hex)
float64-bit floating point
stringUTF-8 text
booltrue / false
arrayOrdered list
mapString-keyed dictionary
nullAbsence of a value

Handle types

Callback parameters can be typed as engine handles. Natives still take plain integer ids.

knight
player::death(int playerid, Player killer, int reason) {
    if (killer != null) {
        SendClientMessage(playerid, "You were killed by {PlayerName(killer)}.");
    }
};

Optional annotations

knight
let score: int = 0;
let speed: float = 1.5;

Checking types at runtime

knight
let v = GetPlayerMoney(playerid);
if (is_number(v)) {
    Log("money is a number: " + str(v));
}
Log("type is " + typeof(v));