split_by_newlines

On this page
  1. wakterm.split_by_newlines(str)

wakterm.split_by_newlines(str)#

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 wakterm = require 'wakterm'

local example = 'hello\nthere\n'

for _, line in ipairs(wakterm.split_by_newlines(example)) do
  wakterm.log_error(line)
end
Edit this page