manoelcampos / xml2lua

XML Parser written entirely in Lua that works for Lua 5.1+. Convert XML to and from Lua Tables 🌖💱
MIT License
290 stars 74 forks source link

XML file is not closed after reading #37

Closed YaroslavSin closed 4 years ago

YaroslavSin commented 4 years ago

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.

manoelcampos commented 4 years ago

Just fixed the issue. Thanks for reporting.