Files
nub-lang/examples/math/math.nub
nub31 583c01201f ...
2026-02-23 18:07:23 +01:00

34 lines
591 B
Plaintext

module math
struct vec2 { x: i32 y: i32 }
struct vec3 { x: i32 y: i32 z: i32 }
struct color { r: i32 g: i32 b: i32 a: i32 }
struct example { a: math::vec2 b: math::vec3 c: math::color }
export enum message {
quit
move {
x: i32
y: i32
}
}
export func add(a: i32 b: i32): i32
{
let message: math::message = enum math::message.move { x = 1 y = 1 }
match message {
quit q {}
move m {
m.x = 23
m.y = 23
}
}
return math::add_internal(a b)
}
func add_internal(a: i32 b: i32): i32
{
return a + b
}