2019-10-21 12:26:31 -03:00
|
|
|
-- This script is an example of saying hello. A lot.
|
2020-03-07 08:59:28 -04:00
|
|
|
-- Pick a random number to send back
|
|
|
|
local number = math.random()
|
2019-10-21 12:26:31 -03:00
|
|
|
|
|
|
|
function update() -- this is the loop which periodically runs
|
|
|
|
gcs:send_text(0, "hello, world") -- send the traditional message
|
2020-03-07 08:59:28 -04:00
|
|
|
|
|
|
|
gcs:send_named_float('Lua Float',number) -- send a value
|
|
|
|
number = number + math.random() -- change the value
|
|
|
|
|
2019-10-21 12:26:31 -03:00
|
|
|
return update, 1000 -- reschedules the loop
|
|
|
|
end
|
|
|
|
|
|
|
|
return update() -- run immediately before starting to reschedule
|