summaryrefslogtreecommitdiff
path: root/src/3rdparty/squirrel/samples/tailstate.nut
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-02-25 01:21:50 +0000
committerrubidium <rubidium@openttd.org>2009-02-25 01:21:50 +0000
commit1ad50ce4e6ed74c8eeb89a1f2780e6ed58a72b2b (patch)
tree0955433146cc59335ddaac1d6e08eb177a9ead61 /src/3rdparty/squirrel/samples/tailstate.nut
parent66a8c0a1325e1f8717150dc6bbe1bcb4fb458bef (diff)
downloadopenttd-1ad50ce4e6ed74c8eeb89a1f2780e6ed58a72b2b.tar.xz
(svn r15578) -Change: unexternalise squirrel.
Diffstat (limited to 'src/3rdparty/squirrel/samples/tailstate.nut')
-rw-r--r--src/3rdparty/squirrel/samples/tailstate.nut24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/3rdparty/squirrel/samples/tailstate.nut b/src/3rdparty/squirrel/samples/tailstate.nut
new file mode 100644
index 000000000..59fb962ef
--- /dev/null
+++ b/src/3rdparty/squirrel/samples/tailstate.nut
@@ -0,0 +1,24 @@
+function state1()
+{
+ ::suspend("state1");
+ return state2();
+}
+
+function state2()
+{
+ ::suspend("state2");
+ return state3();
+}
+
+function state3()
+{
+ ::suspend("state3");
+ return state1();
+}
+
+local statethread = ::newthread(state1)
+
+::print(statethread.call()+"\n");
+
+for(local i = 0; i < 10000; i++)
+ ::print(statethread.wakeup()+"\n");