Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
custom:javascript:lib:modopts.js [2019/07/16 23:47] – [modopts.js] Documented digital man | custom:javascript:lib:modopts.js [2019/07/17 00:25] (current) – Use syntax highlighting digital man | ||
---|---|---|---|
Line 11: | Line 11: | ||
For example: | For example: | ||
- | < | + | < |
[yourmodule] | [yourmodule] | ||
good_thing = true | good_thing = true | ||
Line 24: | Line 24: | ||
Example: | Example: | ||
- | < | + | < |
var options = load({}, " | var options = load({}, " | ||
</ | </ | ||
Line 30: | Line 30: | ||
Now if there is any problem reading the '' | Now if there is any problem reading the '' | ||
- | < | + | < |
var options = load({}, " | var options = load({}, " | ||
if(!options) | if(!options) | ||
Line 38: | Line 38: | ||
Now you can safely reference '' | Now you can safely reference '' | ||
- | < | + | < |
if(options.good_thing == true) | if(options.good_thing == true) | ||
| | ||
Line 50: | Line 50: | ||
If you want to assign default option values, you can assign them right after you '' | If you want to assign default option values, you can assign them right after you '' | ||
- | < | + | < |
var options = load({}, " | var options = load({}, " | ||
if(!options) | if(!options) | ||
Line 64: | Line 64: | ||
Or with string values, you can easily specify defaults //in-line// using the '' | Or with string values, you can easily specify defaults //in-line// using the '' | ||
- | < | + | < |
print(options.other_thing || "some text" | print(options.other_thing || "some text" | ||
</ | </ | ||
Line 80: | Line 80: | ||
For example, to load a //Date// option value: | For example, to load a //Date// option value: | ||
- | < | + | < |
var date_option = load({}, " | var date_option = load({}, " | ||
</ | </ | ||
Line 86: | Line 86: | ||
For example, to load a //String// option (even when it's a valid //Number// or //Boolean// value): | For example, to load a //String// option (even when it's a valid //Number// or //Boolean// value): | ||
- | < | + | < |
var str_option = load({}, " | var str_option = load({}, " | ||
</ | </ | ||
Line 101: | Line 101: | ||
===== See Also ===== | ===== See Also ===== | ||
* [[: | * [[: | ||
+ | * [[: | ||
+ | * [[: | ||
{{tag> | {{tag> | ||