world.ArrayExportKeys

MUSHclient script function (Method) — introduced in version 3.46

Exports keys from an array into a single string

Prototype

VARIANT ArrayExportKeys(BSTR Name, BSTR Delimiter);

Data type meanings

Description

Exports keys from the nominated array.

They keys will be separated by the specified delimiter, for example:

dispel magic,dragonskin,farsight,galvanic whip

The list may be the empty string, which indicates that the array had no values.

You specify the delimiter (eg. a comma) so that you can use different delimiters if you want to. The delimiter must be a single character (eg. ",") other than the backslash character. If the keys contain the delimiter they will be "escaped", for example if the delimiter is a comma then any commas will be exported as backslash-comma. (ie. "," becomes ","). Also, any backslashes are exported as double-backslashes. (eg. "" becomes "").

If you want the key values as well as the names, use ArrayExport.

VBscript example

Note ArrayExportKeys ("spells", ",")

Lua example

Note (ArrayExportKeys ("spells", ","))

Lua notes

The delimiter is optional, and defaults to the "," character.

Return value

If successful, the return value is a string containing the keys for the specified array, separated by the delimiter.

If not successful, the return value is a number (type 'long') with one of the following error codes in it:

eBadArrayName: Name cannot be empty
eArrayDoesNotExist: Array does not exist
eBadDelimiter: The delimiter was not a single character, or was the backslash character

Related topic

Arrays

See also

FunctionDescription
ArrayExportExports values from an array into a single string
ArrayGetGets the value of an array item
ArrayImportImports values into an array from a single string
ArrayListKeysGets the list of all the keys in an array
ArraySetSets the value of an array item