From 1edff5f4efacfb1e3d628b259f8a73513283a054 Mon Sep 17 00:00:00 2001 From: Geoff Leyland Date: Thu, 19 Jun 2014 16:24:04 +1200 Subject: [PATCH] Document after that last commit making it more useful --- lua/csv.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lua/csv.lua b/lua/csv.lua index 0b44842..43507d3 100644 --- a/lua/csv.lua +++ b/lua/csv.lua @@ -410,7 +410,18 @@ local buffer_mt = buffer_mt.__index = buffer_mt -local function use(buffer, parameters) +--- Use an existing file or buffer as a stream to read csv from. +-- (A buffer is just something that looks like a string in that we can do +-- `buffer:sub()` and `buffer:find()`) +-- @return a file object +local function use( + buffer, -- ?string|file|buffer: the buffer to read from. If it's: + -- - a string, read from that; + -- - a file, turn it into a file_buffer; + -- - nil, read from stdin + -- otherwise assume it's already a a buffer. + parameters) -- ?table: parameters controlling reading the file. + -- See README.md parameters = parameters or {} parameters.filename = parameters.filename or "" parameters.column_map = parameters.columns and