dicegame/mode/bet.fnl

20 lines
510 B
Plaintext
Raw Normal View History

2021-10-02 20:47:53 +00:00
{
: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)
)
)
)
}