Jump to content

xml bad argument


Dice

Recommended Posts

  
filesxml = xmlLoadFile ( "files.xml" ) 
if filesxml then 
    aChild= xmlFindChild ( filesxml, "sav", 0 ) 
else 
    aChild = xmlCreateFile ( "files.xml", "sav" ) 
    xmlSaveFile ( aChild ) 
end 
  
function removething( gridlist, name, row, col ) 
    guiGridListRemoveRow ( gridlist, row ) 
    delete = xmlFindChild ( aChild, "filename", 0 ) -- bad argument here @ xmFindChild  
    outputChatBox ( name .. " removed!" ) 
end 

in function removething. btw 'filename' gets created from another function it exists. The problem is aChild why does it keep doing bad argument here @ xmFindChild at line 12. I know it exists!!

Link to comment
  
addEventHandler ( "onClientResourceStart", resourceRoot, 
function() 
filesxml = xmlLoadFile ( "files.xml" ) 
if filesxml then 
    aChild= xmlFindChild ( filesxml, "sav", 0 ) 
else 
    aChild = xmlCreateFile ( "files.xml", "sav" ) 
    xmlSaveFile ( aChild ) 
end 
end) 
  
function removething( gridlist, name, row, col ) 
    guiGridListRemoveRow ( gridlist, row ) 
local filesxml = xmlLoadFile ( "files.xml" ) 
local aChild= xmlFindChild ( filesxml, "sav", 0 ) 
local delete = xmlFindChild ( aChild, "filename", 0 ) 
    outputChatBox ( name .. " removed!" ) 
end 

I think this will work, I didn't tested it since I needed to go, because you used when the "save" didn't excisted a new file, after that it doesn't matter if you are reading it on the client side twice since the server isn't reading it, so the server won't lag. I'm btw sleepy, sorry for my faults.

Link to comment
function removething( gridlist, name, row, col ) 
    guiGridListRemoveRow ( gridlist, row ) 
local xmlFile = xmlLoadFile ( "files.xml" )  
if xmlFile then 
    local node = xmlFindChild( xmlFile, "filename", 0 )  
    local success = xmlNodeGetValue ( node )  
    if success then 
        outputChatBox ( tostring ( success ) )  
    end 
end 
end 

I relooked at the wiki and then i saw the function xmlNodeGetValue.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...