Skip to content

Type aliases

Type aliases allow you to create named shortcuts for complex or reusable types.

alias ID = number
pub alias Config = struct{ number hp, fixed speed }

Aliases work just like the types they represent — you can use them anywhere a type is expected:

alias PlayerID = number
fn GetPlayerName(PlayerID id) -> text {
return "Player " .. ToString(id)
}
let myId: PlayerID = 42
Pewpew:Print(GetPlayerName(myId)) // Player 42

Use pub to export a type alias for use in other files:

pub alias Vec2 = struct{ fixed x, y }
pub alias GameConfig = struct{ number max_players, fixed world_size }