Types

.struct

C.struct(opt: map) -> fn

Create a C struct interface.

Params (1)

opt

A type descriptor in map, like { name: type }

Return value

A function that can be create a struct as map.

var Point = C.struct {
    x: C.INT,
    y: C.INT
}

var pt = Point(10, 20)
var pt2 = Point {
    x: 6,
    y: 7
}

puts pt.x + pt2.y
puts pt.__ref        // get the address

Last updated

Was this helpful?