Skip to content

wezterm.split_by_newlines(str)

Since: Version 20200503-171512-b13ef15f

The functionality described in this section requires version 20200503-171512-b13ef15f of wezterm, or a more recent version.

This function takes the input string and splits it by newlines (both \n and \r\n are recognized as newlines) and returns the result as an array of strings that have the newlines removed.

local wezterm = require 'wezterm'

local example = 'hello\nthere\n'

for _, line in ipairs(wezterm.split_by_newlines(example)) do
  wezterm.log_error(line)
end