- 662
- 700
Раз на то пошло. table.insert очень сильно тупит!Lua:function deleteLine(filePath, text) local tableOfLines = {} for line in io.lines(filePath) do if not u8:decode(line):find(text) then table.insert(tableOfLines, line) end end local file = io.open(filePath, 'w+') file:write(table.concat(tableOfLines), "\n") file:close() end
Lua:
function deleteLine(filePath, text)
local tableOfLines = {}
for line in io.lines(filePath) do
if not u8:decode(line):find(text) then
tableOfLines[#tableOfLines + 1] = line
end
end
local file = io.open(filePath, 'w+')
file:write(table.concat(tableOfLines), "\n")
file:close()
end