aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/file_io.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2013-05-26 16:14:10 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2013-05-26 16:14:10 -0400
commitd6b32bf2bd4a94a3fe7b70719a8f91061fd9a3f6 (patch)
tree90957965bfbf13b8b8d0e26710766607175aaad4 /core/file_io.lua
parentd4bf79910abac50dffadc64e4e2f22429a8dc3b1 (diff)
Rewrote some LuaDoc to use the active voice.
Diffstat (limited to 'core/file_io.lua')
-rw-r--r--core/file_io.lua30
1 files changed, 17 insertions, 13 deletions
diff --git a/core/file_io.lua b/core/file_io.lua
index 7dd0e354..24fa4a8a 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -6,22 +6,26 @@
--
-- ## Working with UTF-8
--
--- If your filesystem does not use UTF-8-encoded filenames (e.g. Windows),
--- 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 automatically, but if you need to do
--- them manually, use [`string.iconv()`][] along with [`_CHARSET`][], your
--- filesystem's detected encoding. An example is
+-- Textadept encodes all of its filenames, like [`buffer.filename`][], in UTF-8.
+-- If you try to use Lua to access the file associated with such a filename, you
+-- may not get the right file if your filesystem's encoding is not UTF-8 (e.g.
+-- Windows).
--
--- <div style="clear: right;"><!-- Clear Table of Contents --></div>
+-- -- May not work on non-UTF-8 filesystems.
+-- local f = io.open(buffer.filename, 'rb')
--
--- 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)
+-- You need to convert the filename to the filesystem's encoding using
+-- [`string.iconv()`][] along with [`_CHARSET`][]:
--
+-- local name = string.iconv(buffer.filename,
+-- _CHARSET, 'UTF-8')
+-- local f = io.open(name, 'rb')
+--
+-- Textadept automatically performs filename conversions for you when opening
+-- and saving files through dialogs. You only need to do manual conversions when
+-- working with the filesystem directly from Lua.
+--
+-- [`buffer.filename`]: buffer.html#filename
-- [`string.iconv()`]: string.html#iconv
-- [`_CHARSET`]: _G.html#_CHARSET
-- @field _G.events.FILE_OPENED (string)