Installer import into contrib (real import this time)
[dragonfly.git] / contrib / bsdinstaller-1.1.6 / src / backend / lua / scripts / test / fsm.lua
1 -- fsm.lua
2 -- $Id: fsm.lua,v 1.5 2004/11/26 00:31:03 cpressey Exp $
3 -- Test of the FSM library.
4
5 require("fsm")
6
7 -- manually create a finite state machine,
8 -- manually populate it with states, and
9 -- manually start it:
10
11 fsm = FSM.new()
12
13 fsm:register({
14     name = "start",
15     action = function()
16         print("This is the start.")
17         return "middle"
18     end})
19
20 fsm:register({
21     name = "middle",
22     action = function()
23         print("Also, this is the middle...")
24         return "end"
25     end})
26
27 fsm:register({
28     name = "end",
29     action = function()
30         print("And finally, this is the end!")
31         return nil
32     end})
33
34 fsm:run("start")