From 43763091bdee10706a3ae3fde1031f1e0d3a8ad1 Mon Sep 17 00:00:00 2001 From: Peter Hall <33176108+IamPete1@users.noreply.github.com> Date: Sat, 7 Mar 2020 12:59:28 +0000 Subject: [PATCH] AP_Scripting: add send_named_float to simple loop example --- libraries/AP_Scripting/examples/simple_loop.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/AP_Scripting/examples/simple_loop.lua b/libraries/AP_Scripting/examples/simple_loop.lua index 22e798098e..46330f938c 100644 --- a/libraries/AP_Scripting/examples/simple_loop.lua +++ b/libraries/AP_Scripting/examples/simple_loop.lua @@ -1,7 +1,13 @@ -- This script is an example of saying hello. A lot. +-- Pick a random number to send back +local number = math.random() function update() -- this is the loop which periodically runs gcs:send_text(0, "hello, world") -- send the traditional message + + gcs:send_named_float('Lua Float',number) -- send a value + number = number + math.random() -- change the value + return update, 1000 -- reschedules the loop end