Aego Русский

Files and packages

A package that fails to compile keeps its last good build; its files are marked invalid and Play is blocked until they compile again.

Run it: one package with exported and package-private declarations. The sandbox compiles a single file, so imports between script packages need a project.

package inventory

import (
    "aego/log"
    "aego/math"
)

// MaxSlots is exported: other packages read it as inventory.MaxSlots.
const MaxSlots int = 8

// stackSize is package-private.
const stackSize int = 20

// Fit is exported and can be called from other packages.
func Fit(count int) int {
    return math.MinInt(count, MaxSlots * stackSize)
}

script Bag {
    @export var Count int = 200

    func Ready() {
        log.Info("package inventory keeps " + string(Fit(Count)) + " of " + string(Count) + " items")
    }
}