function monsterExists(name)
local file = "data/monster/monsters.xml"
local openFile = io.open(file, "r")
local m_name, getName, getFile, m_file = 0, 0, 0, 0
local monsterExists, fileExists = false, false
if openFile ~= nil then
for line in io.lines(file) do
if line:find('name=".*".*') and line:find('file=".*".*') then
getName = string.match(line, 'name=".*".*')
getFile = string.match(line, 'file=".*".*')
m_name = string.sub(getName, string.find(getName, '="') + 2, string.find(getName, '" ') - 1)
[COLOR="#FF0000"]m_file = string.sub(getFile, string.find(getFile, '="') + 2, (string.find(getFile, '"/') or string.find(getFile, '" /')) - 1)[/COLOR]
if m_name == name then
monsterExists = true
mfile = io.open("data/monster/" .. m_file, "r")
if mfile ~= nil then
fileExists = true
mfile:close()
end
end
end
end
openFile:close()
end
return monsterExists and fileExists or false
end