> LeekScript
Since update 2.38, it is possible to use types in LeekScript.
void: no typeany: any valuenull: null valueboolean: Boolean valueinteger: whole numberreal: real numberstring: character stringArray, Array: list or list of X valuesMap, Map: table or table of keys K and values VObject: objectFunction, Function R>: general function or function which takes the arguments A and B and returns R.Class: classUse the | sign to create compound types, for example integer | string represents a value which can be either an integer or a string.
It is possible to combine as many types as desired: integer | boolean | string | Array for example.
To write a compound type with null, for example Array | null, it is possible to write Array?.
The ! operator converts a value type by removing the null type. It will not convert the actual value. For example, for a type integer | null:
It is possible to use it in an object access chain: object.toto!.tutu But if objet.toto is null, then it will crash on execution. The main use of this operator is removing warnings in strict mode and assert that a type is not null on execution.
The as operator converts a value to any type, if possible:
Impossible de charger les données du jeu.
Vérifiez votre connexion et réessayez.