summaryrefslogtreecommitdiffstats
path: root/doc/examples/mobile/lua_timer.lua
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/mobile/lua_timer.lua')
-rw-r--r--doc/examples/mobile/lua_timer.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/examples/mobile/lua_timer.lua b/doc/examples/mobile/lua_timer.lua
new file mode 100644
index 00000000..1119af81
--- /dev/null
+++ b/doc/examples/mobile/lua_timer.lua
@@ -0,0 +1,12 @@
+-- See https://www.lua.org/manual/5.3/ for Lua
+-- See http://ftp.osmocom.org/docs/latest/osmocombb-usermanual.pdf -- Scripting with Lua
+
+-- Start and stop timer with callback. Schedule a timeout and
+-- resume execution then.
+
+-- Timeout in 10 seconds
+local timer = osmo.timeout(10, function()
+ print("Timeout occurred");
+end)
+-- We can cancel it. The callback will not be called
+timer:cancel()