ludic/examples/modules/kinds/fishing/index.ludic

20 lines
476 B
Text

# fishing/index.ludic - a private record and a private event, spelt as hunting spells its own
module fishing
property Catch {
fish: int = 0
}
event Landed { fish: int }
var landed: int = 0
var last: Catch = null
@On(Landed) handler Count { landed += fish }
function catch_new(n: int) -> Catch {
let c = new Catch
c.fish = n
return c
}
export function fishing_day() -> int {
last = catch_new(3)
emit Landed(fish: last.fish)
emit Landed(fish: 4)
return landed
}