Posted 08 January 2015 - 08:38 AM
Hi, I have this code:
I've tried commenting out the "if f then" blocks.
But it just says:
xml:10: index expected, got nil
Line 10 is function xml:create( file ). (I cut some of it out.)
The other file calls it using bool = xml:create( "test" )
but it just does it again.
Help?
function xml:create( file ) -- Generates a base XML file which is compatible with this parser
f = fs.open( file, "w" )
if f then
f.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n")
f.write("<CC>\n")
f.write(" <!-- Please put all your XML inside the <CC> tags! Thanks! -->\n")
f.write("</CC>")
f.close()
return true
else
return false
end
I've tried commenting out the "if f then" blocks.
But it just says:
xml:10: index expected, got nil
Line 10 is function xml:create( file ). (I cut some of it out.)
The other file calls it using bool = xml:create( "test" )
but it just does it again.
Help?