Got a question that the wiki doesn't answer? Ask on the forum (preferred), or join us on IRC.



From Wiki
Jump to: navigation, search

Vital Info

Name export
Returns void
Usages key, value
Throws IllegalArgumentException


Since 3.3.0
Optimizations None


Stores a value in the global storage register. An arbitrary value is stored with the given key, and can be retreived using import. If the value is already stored, it is overwritten. See import(). The reference to the value is stored, not a copy of the value, so in the case of arrays, manipulating the contents of the array will manipulate the stored value. An array may be used as a key. It is converted into a string with the array values separated by dots. export() is threadsafe.


export(key, value)

Examples (How do these work?)

Example 1

Basic usage

Given the following code:

1   @var = 2;
2   export(''@var);
3   @var2 = import('');
4   msg(@var2);

The output would be:


Example 2

Storage of references

Given the following code:

1   @array = array(1, 2, 3);
2   export('array'@array);
3   @array[0] = 4;
4   @array2 = import('array');
5   msg(@array2);

The output would be:

{4, 2, 3}

Example 3

Array key usage

Given the following code:

1   @key = array(custom, name);
2   export(@key'value');
3   @value = import(@key);
4   msg(@value);

The output would be:


Example 4

Default value usage

Given the following code:

1   export(''null);
2   @value = import('''default value');
3   msg(@value);

The output would be:

default value

See Also


Navigation menu