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:06] – Corrected the conditional explanation dbareis | lua [2024/10/20 20:29] (current) – Added volume controls frutejuise | ||
---|---|---|---|
Line 20: | Line 20: | ||
===== Conditional Statements ===== | ===== Conditional Statements ===== | ||
- | Conditional statements (IF-THEN-ELSE) work in much the same as most languages (there are some examples below), for more information see http:// | + | Conditional statements (IF-THEN-ELSE) work in much the same as most languages |
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 200: | Line 207: | ||
===== WatchMaker Lua API ===== | ===== WatchMaker Lua API ===== | ||
- | 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_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(" | ||
is_bright | is_bright | ||
+ | |||
+ | *About wm_action w_app | ||
+ | |||
+ | The delimiter for the app link is a backtick '' | ||
+ | |||
+ | * App name (may be empty) | ||
+ | * Package name | ||
+ | * Activity name (optional) | ||
+ | |||
+ | The app name is optional. If it is empty, the app main activity is launched. Example: '' | ||
+ | |||
+ | The easiest way to find the package name (example '' | ||
+ | |||
+ | Available activities of apps can be obtained by downloading the APK file and uploading it to https:// | ||
===== Tweening Functions ===== | ===== Tweening Functions ===== |
lua.1451268417.txt.gz · Last modified: 2015/12/28 02:06 by dbareis