string_array classmod

String Array Metatable For working with string arrays without duplicate values

Tables

string_array.metatable The following metamethods are provided.

Methods

string_array:has(name) Does this array contain name.
string_array:add(name) Add a string to the array if it doesn’t exist in the array.
string_array:remove(name) Remove the string from the array if it exists.
string_array:toggle(name) Toggles the passed name in the array by adding it if not present or removing it if it is.
string_array:clear() Clear the array returning an empty array object
string_array:tostring() Convert the array to a string
string_array:concat(rhs) Concat string-arrays and strings together

Tables

# string_array.metatable

The following metamethods are provided.

Fields:
  • __index : Index to the string array class.
  • __tostring : tostring.
  • __concat : adds the right hand side to the object.
  • __add : Adds a string to the string-array object.
  • __sub : Removes a string from the string-array object.
  • __unm : Clears the array.
  • __call : Array contains this string.

Methods

# string_array:has(name)

Does this array contain name.

Parameters:
  • name : (string) The string to find.
Returns:
# string_array:add(name)

Add a string to the array if it doesn’t exist in the array.

Parameters: Returns:
  • (self)
# string_array:remove(name)

Remove the string from the array if it exists.

Parameters: Returns:
  • (self)
# string_array:toggle(name)

Toggles the passed name in the array by adding it if not present or removing it if it is.

Parameters: Returns:
  • (self)
# string_array:clear()

Clear the array returning an empty array object

Returns:
  • (self)
# string_array:tostring()

Convert the array to a string

Returns:
# string_array:concat(rhs)

Concat string-arrays and strings together

Parameters: Returns: