From 189123ee42559641a4b63c5b42e3feae7f4e30f2 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 22 Oct 2019 02:26:31 +1100 Subject: [PATCH] AP_Scripting: add simple example of a loop --- libraries/AP_Scripting/examples/simple_loop.lua | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 libraries/AP_Scripting/examples/simple_loop.lua diff --git a/libraries/AP_Scripting/examples/simple_loop.lua b/libraries/AP_Scripting/examples/simple_loop.lua new file mode 100644 index 0000000000..22e798098e --- /dev/null +++ b/libraries/AP_Scripting/examples/simple_loop.lua @@ -0,0 +1,8 @@ +-- This script is an example of saying hello. A lot. + +function update() -- this is the loop which periodically runs + gcs:send_text(0, "hello, world") -- send the traditional message + return update, 1000 -- reschedules the loop +end + +return update() -- run immediately before starting to reschedule