HadesLang Doc
Search…
Declaring protos

Import statements

Protos are usually created when importing libraries or external code.

Instantiable protos

Classes and structs are imported as protos. The constructor of a class or struct is therefore an instantiable proto.

Non-instantiable protos

Every other proto (fixed classes, libraries) are not instantiable. You can call methods and instantiate classes on non-instantiable protos.
1
with math from std:math
2
3
var res = math.sqrt(16) //call a function on the proto
4
5
var velocity = math.Function("10x²+5x+3") //instantiate an object from the proto
6
var position = fn.integrate()
Copied!

Manually declaring protos

Protos as variables

One can declare variables with the datatype proto. This is useful to create aliases for protos or pass protos to functions.
Last modified 2yr ago