mirror of
https://github.com/geoffleyland/lua-csv.git
synced 2024-11-23 01:34:19 +00:00
csv.lua: move some variable definitions closer to their use (the aim here is to move find and sub out into a buffer object)
This commit is contained in:
parent
e0123ee133
commit
deac119c13
13
lua/csv.lua
13
lua/csv.lua
@ -150,13 +150,9 @@ end
|
|||||||
-- the buffer.
|
-- the buffer.
|
||||||
local function separated_values_iterator(file, parameters)
|
local function separated_values_iterator(file, parameters)
|
||||||
local buffer_size = parameters.buffer_size or DEFAULT_BUFFER_SIZE
|
local buffer_size = parameters.buffer_size or DEFAULT_BUFFER_SIZE
|
||||||
local filename = parameters.filename or "<unknown>"
|
|
||||||
local buffer = ""
|
local buffer = ""
|
||||||
local anchor_pos = 1
|
local anchor_pos = 1
|
||||||
local line, line_start = 1, 1
|
local line_start = 1
|
||||||
local column_name_map = parameters.columns and
|
|
||||||
build_column_name_map(parameters.columns)
|
|
||||||
local column_index_map
|
|
||||||
|
|
||||||
|
|
||||||
-- Cut the front off the buffer if we've already read it
|
-- Cut the front off the buffer if we've already read it
|
||||||
@ -208,6 +204,13 @@ local function separated_values_iterator(file, parameters)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local filename = parameters.filename or "<unknown>"
|
||||||
|
local line = 1
|
||||||
|
local column_name_map = parameters.columns and
|
||||||
|
build_column_name_map(parameters.columns)
|
||||||
|
local column_index_map
|
||||||
|
|
||||||
|
|
||||||
-- If the user hasn't specified a separator, try to work out what it is.
|
-- If the user hasn't specified a separator, try to work out what it is.
|
||||||
local sep = parameters.separator
|
local sep = parameters.separator
|
||||||
if not sep then
|
if not sep then
|
||||||
|
Loading…
Reference in New Issue
Block a user