|
The following table lists the DekiScript literal values.
| Data Type | Description |
| nil | The empty value, represented by _, nil, and null. |
| bool | A logical value, represented by true and false. |
| num | A 64-bit floating point value. |
| str | A character string. |
| magic identifier | An automatically generated string that is guaranteed to be unique across scopes. |
| map | An associative array that assigns a key to an expression. |
| list | An indexed array of expressions. |
The empty value is represented by _, nil, and null. All tokens are synonymous and their variations are provided for convenience.
1.8.1 or later.
| Output | ||
|
|
A logical value, represented by true and false.
1.8.1 or later.
| Output | ||
| 0
| |
| Today is not Thursday
|
Numbers must have a decimal part and may have an optional decimal exponent. DekiScript also accepts hexadecimal constants, by prefixing them with 0x. Numbers are stored as 64-bit floating point values.
Examples of valid numbers are:
Refer here for a comprehensive list of DekiScript number functions and variables.
1.8.1 or later.
| Output | ||
| 32.2744 | |
| $5.75 |
A character string. Strings can be delimited by matching single or double quotes and can contain these escape sequences: '\a' (bell), '\b' (backspace), '\f' (form feed), '\n' (newline), '\r' (carriage return), '\t' (horizontal tab), '\uXXXX' (encoded character where 'XXXX' is the hexadecimal unicode value), '\v' (vertical tab), '\\' (backslash), '/' (slash), '\"' (double quote), and '\'' (single quote). Strings in DekiScript may contain any 16-bit value, including embedded zeros, which can be specified as '\0'.
Starting in v1.9.1, the characteres of a string can be accessed by using a numeric expression surrounded by brackets ([]). The first character in a string has index 0. If the index is not within range, the expression evaluates to nil.
Refer here for a comprehensive list of DekiScript string functions.
1.8.1 or later.
| Output | ||
| Hello world!
| |
| 12
| |
| This is a single quote: ' and this is a double quote: " | |
| This is a single quote: ' and this is a double quote: " | |
| e
|
An automatically generated string that is guaranteed to be unique across scopes. The scope of a magic identifier is a single page or template instance. For example, if a page or template is loaded multiple times via inclusion, each page will have unique values for its magic identifiers.
Magic identifiers are commonly used to create channels for PubSub communication. By using magic identifiers, the channels are guaranteed to be unique and not interfere with similarly named channels on other included pages.
1.8.2 or later.
| Output | ||
| myid_Vucsnpo1
| |
|
| |
| N/A |
An indexed array of expressions. The evaluation order of expressions inside a list is non-deterministic. Examples of valid lists are:
The values of a list are accessed by using a numeric expression surrounded by brackets ([]). If the index is not within range, the expression evaluates to nil.
1.8.1 or later.
| Output | ||
| 3 | |
| item1/item2/item3 | |
| [ 1, 2 ] |
An associative array that assigns a key to an expression. The key can either be a name, a string, a number, or another expression. If the key expression evaluates to a literal that has not string representation or is nil, the value expression is not evaluated. The evaluation order of expressions inside a map is non-deterministic. Examples of valid maps are:
The values of a map are accessed by providing the key either as a name preceded by a dot (.) or as an expression surrounded by brackets ([]). If the key is not found in the map, the expression evaluates to nil.
1.8.1 or later.
| { SteveB : 6 } | |
| 3 | |
| 1 | |
| Hello World! |
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |
Copyright © 2011 MindTouch, Inc. Powered by