Renusek
beton beton beton punk!
Hello, I've wrote some time ago a function and just found it inside my fapfolder(don't ask...).
So I'm posting it, maybe someone will find it usefull.
And some tests:
returned:
Yours,
Renusek.
So I'm posting it, maybe someone will find it usefull.
Lua:
local XML = ''
do
local o = io.open('spells.xml','r')
XML = o:read('*a')
o:close()
end
--isSpell(string spell[, bool lower = false])
function isSpell(txt, lower)
lower = false or lower
if lower == true then
txt = tostring(txt):lower()
XML = tostring(XML):lower()
end
if XML:match('<instant name="' .. txt .. '".->(.-)</instant>')
or XML:match('<instant(.-)words="' .. txt .. '".->(.-)</instant>')
or XML:match('<conjure name="' .. txt .. '".->(.-)</conjure>')
or XML:match('<conjure(.-)words="' .. txt .. '".->(.-)</conjure>') then
return true
end
return false
end
And some tests:
Lua:
print(isSpell('exura gran'), -- instant words
isSpell('adura VITA', true), -- conjure words
isSpell('Intense Healing', true), -- instant name
isSpell('Conjure Arrow', true), -- conjure name
isSpell('this wont work')
)
print(os.clock())
true true true true false
0.366
Yours,
Renusek.
Last edited: