Joins a list of strings together with a given separator. If given a list of strings not already in a table, this function can be used instead of table.concat for better performance.

Also available as string.join (though not provided by the Lua standard library).


See also Utility functions.

Signature:

text = strjoin("sep", ...)

Arguments:

  • sep - A separator to insert between joined strings (string)
  • ... - A list of strings to be joined together (list)

Returns:

  • text - The list of strings joined together with the given separator string (string)

Examples:

strjoin(",", "alice", "bob", "carol")
-- Returns "alice,bob,carol"

strjoin(" mississippi, ", "one", "two", "three")
-- Returns "one mississippi, two mississippi, three