Contents

io

Extends Lua’s io package to provide file input/output routines for Textadept.

Working with UTF-8

If your filesystem does not use UTF-8 encoded filenames, conversions to and from that encoding are necessary since all of Textadept’s internal strings are UTF-8 encoded. When opening and saving files through dialogs, these conversions are performed autmatically, but if you need to do them manually, use string.iconv() along with _CHARSET, your filesystem’s detected encoding.

Example:

events.connect(events.FILE_OPENED, function(utf8_filename)
  local filename = utf8_filename:iconv(_CHARSET, 'UTF-8')
  local f = io.open(filename, 'rb')
  -- process file
  f:close()
end)

File Events


Functions


close_all ()

Closes all open buffers. If any buffer is dirty, the user is prompted to continue. No buffers are saved automatically. They must be saved manually.

Usage:

Return:


open_file (utf8_filenames)

Opens a list of files.

Parameters:

Usage:


open_recent_file ()

Prompts the user to open a recently opened file.

See also:


save_all ()

Saves all dirty buffers to their respective files.

Usage:


Tables


boms

List of byte-order marks (BOMs).


recent_files

List of recently opened files. The most recent are towards the top.


try_encodings

List of encodings to try to decode files as after UTF-8.