parent
73afe0e954
commit
52fbf49309
|
@ -63,8 +63,7 @@ end
|
||||||
-- @param id The data.history identifier which is the path to the filename.
|
-- @param id The data.history identifier which is the path to the filename.
|
||||||
-- @param[opt] max The maximum number of entries in file.
|
-- @param[opt] max The maximum number of entries in file.
|
||||||
local function history_check_load(id, max)
|
local function history_check_load(id, max)
|
||||||
if id and id ~= ""
|
if id and id ~= "" and not data.history[id] then
|
||||||
and not data.history[id] then
|
|
||||||
data.history[id] = { max = 50, table = {} }
|
data.history[id] = { max = 50, table = {} }
|
||||||
|
|
||||||
if max then
|
if max then
|
||||||
|
@ -72,9 +71,9 @@ local function history_check_load(id, max)
|
||||||
end
|
end
|
||||||
|
|
||||||
local f = io.open(id, "r")
|
local f = io.open(id, "r")
|
||||||
|
if not f then return end
|
||||||
|
|
||||||
-- Read history file
|
-- Read history file
|
||||||
if f then
|
|
||||||
for line in f:lines() do
|
for line in f:lines() do
|
||||||
if util.table.hasitem(data.history[id].table, line) == nil then
|
if util.table.hasitem(data.history[id].table, line) == nil then
|
||||||
table.insert(data.history[id].table, line)
|
table.insert(data.history[id].table, line)
|
||||||
|
@ -85,7 +84,6 @@ local function history_check_load(id, max)
|
||||||
end
|
end
|
||||||
f:close()
|
f:close()
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function is_word_char(c)
|
local function is_word_char(c)
|
||||||
|
|
Loading…
Reference in New Issue