20 lines
510 B
Plaintext
20 lines
510 B
Plaintext
|
{
|
||
|
:name "bet"
|
||
|
|
||
|
:display (fn [p]
|
||
|
(print (string.format "You have $%d." p.cash))
|
||
|
(print (string.format "Your current bet is $%d." p.bet))
|
||
|
(print "Enter a new bet.\n")
|
||
|
(io.write "> ")
|
||
|
)
|
||
|
|
||
|
:key-pressed (fn key-pressed [p amt set-mode]
|
||
|
(let [valid? (<= (tonumber amt) p.cash)]
|
||
|
(when valid?
|
||
|
(set p.bet amt)
|
||
|
(set-mode :mode.menu)
|
||
|
)
|
||
|
)
|
||
|
)
|
||
|
}
|