function xml2lua.loadFile(xmlFilePath)
local f, e = io.open(xmlFilePath, "r")
if f then
--Gets the entire file content and stores into a string
local content = f:read("*a")
f:close()
return content
end
error(e)
end
In some case, for example, if XML file is temporary created, I can delete this file, because the file is not closed by xml2lua.
Module xml2lua.lua
I thin, need to add f:close()
function xml2lua.loadFile(xmlFilePath) local f, e = io.open(xmlFilePath, "r") if f then --Gets the entire file content and stores into a string local content = f:read("*a") f:close() return content end error(e) end
In some case, for example, if XML file is temporary created, I can delete this file, because the file is not closed by xml2lua.