title: Lua - Threading
body: <p>In the following code i read values from a device, add a timestamp to it and send the string via e-mail. The function "send_email()" needs 3 minutes and stops the rest of the code from working.
  So my aim is to execute the function "send_email()" on another thread or similar, so that there is no gap of 3 minutes between the collected datasets. Because in this time no new data will be received, but i need to collect all data.</p>
  
  <pre><code>It should give out:   value_10:30:00 -&gt; value_10:30:10 -&gt; value_10:30:20...
  not:                  value_10:30:00 -&gt; value_10:33:10 -&gt; value_10:36:20...
  </code></pre>
  
  <p>Note that the following code is pseudo code. </p>
  
  <pre><code>function main()
  
      time     = get_time()  --prints the clocktime (format: hour, minutes, seconds)
      mystring = read_value_from_device()
      mystring = mystring .. "_" .. time
  
      send_email(mystring) --send email (this takes up to 3 minutes!)
  
      sleep(10)    --sleeps 10 seconds
  
      main()       --call function again
  end
  </code></pre>