Watchmaker Wiki

The ultimate watch maker for Android Wear!

User Tools

Site Tools


lua

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
lua [2017/07/05 10:29] alex_curranlua [2017/08/08 14:24] – [Run Lua Function Every Hour, Minute, Second or Millisecond] alex_curran
Line 141: Line 141:
 You are recommended to keep Tap Action scripts shorter e.g. by running functions in the main script file, as Tap Action scripts are stored in the XML file and not the separate script file. You are recommended to keep Tap Action scripts shorter e.g. by running functions in the main script file, as Tap Action scripts are stored in the XML file and not the separate script file.
  
-===== Run Lua Function Every Second or Millisecond =====+===== Run Lua Function Every Hour, Minute, Second or Millisecond ===== 
 + 
 +    function on_hour(h)           - every hour (h = hour) 
 +    function on_minute(h, m)      - every minute (h = hour, m = minute) 
 +    function on_second(h, m, s)   - every second (h = hour, m = minute, s = second) 
 +    function on_millisecond(dt)   - every millisecond (dt = delta time)
  
 If you have some custom variables that update every millisecond, you can create an //on_millisecond(..)// function in your script file. This function will be called every millisecond. In the example below this will move points around a circle (co-ordinates stored in var_ms_posx and var_ms_posy) : If you have some custom variables that update every millisecond, you can create an //on_millisecond(..)// function in your script file. This function will be called every millisecond. In the example below this will move points around a circle (co-ordinates stored in var_ms_posx and var_ms_posy) :
lua.txt · Last modified: 2020/07/24 09:32 by alexcurran1