Tipe & Variabel
Tipe primitif, handle, null, dan aturan tipe.
Tipe primitif
| Tipe | Keterangan |
|---|---|
int | Integer bertanda 64-bit (desimal atau hex 0x) |
float | Floating point 64-bit |
string | Teks UTF-8 |
bool | true / false |
array | Daftar terurut |
map | Dictionary dengan key string |
null | Tidak ada nilai |
Tipe handle
Parameter callback bisa bertipe handle engine. Native tetap memakai id integer biasa.
knight
player::death(int playerid, Player killer, int reason) {
if (killer != null) {
SendClientMessage(playerid, "Kamu dibunuh oleh {PlayerName(killer)}.");
}
};
Anotasi opsional
knight
let score: int = 0;
let speed: float = 1.5;
Cek tipe saat runtime
knight
let v = GetPlayerMoney(playerid);
if (is_number(v)) {
Log("uang berupa angka: " + str(v));
}
Log("tipenya " + typeof(v));