lua
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
lua [2015/12/28 02:08] – dbareis | lua [2020/07/24 09:32] (current) – alexcurran1 | ||
---|---|---|---|
Line 57: | Line 57: | ||
===== Strings ===== | ===== Strings ===== | ||
- | Texts can be manipulated through the [[http:// | + | Text [[http:// |
+ | |||
+ | You can quote strings with double or single quotes so 'some text' is also a string. | ||
==== Methods ==== | ==== Methods ==== | ||
Line 63: | Line 65: | ||
Upper/ | Upper/ | ||
- | string.upper({ddww}) | + | string.upper('{ddww}') |
- | string.lower({ddww}) | + | string.lower('{ddww}') |
Reverse a string: | Reverse a string: | ||
- | string.reverse({ddww}) | + | string.reverse('{ddww}') |
Shorten a string (use only first 20 chars): | Shorten a string (use only first 20 chars): | ||
Line 139: | 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, |
+ | |||
+ | function on_hour(h) | ||
+ | function on_minute(h, | ||
+ | function on_second(h, | ||
+ | function on_millisecond(dt) | ||
If you have some custom variables that update every millisecond, | If you have some custom variables that update every millisecond, | ||
Line 202: | Line 209: | ||
WatchMaker extends the Lua commandset. Just use the wm_action() or other functions anywhere in your script or tap actions : | WatchMaker extends the Lua commandset. Just use the wm_action() or other functions anywhere in your script or tap actions : | ||
- | wm_action(' | + | wm_action(' |
- | wm_action(' | + | wm_action(' |
- | wm_action(' | + | wm_action(' |
- | wm_action(' | + | wm_action(' |
+ | | ||
+ | wm_action(' | ||
+ | wm_action(' | ||
+ | wm_action(' | ||
+ | wm_action(' | ||
+ | wm_action(' | ||
+ | wm_action(' | ||
+ | | ||
wm_schedule(' | wm_schedule(' | ||
wm_unschedule_all() | wm_unschedule_all() | ||
wm_vibrate(d, | wm_vibrate(d, | ||
+ | wm_sfx(' | ||
wm_transition(' | wm_transition(' | ||
+ | wm_anim_set(' | ||
+ | wm_anim_set(' | ||
+ | wm_anim_start(' | ||
wm_tag(' | wm_tag(' | ||
return a value of a WatchMaker tag, e.g. wm_tag(" | return a value of a WatchMaker tag, e.g. wm_tag(" |
lua.1451268483.txt.gz · Last modified: 2015/12/28 02:08 by dbareis