Jump to content

Bad argument


Beluga

Recommended Posts

addEvent("registerPlayer",true) 
addEventHandler("registerPlayer",getRootElement(), 
function(username,password) 
    local xmlFile = xmlLoadFile("players.xml") 
    local playerNode = xmlFindChild(xmlFile,"players",0) 
    if (playerNode) then 
        xmlCreateChild(playerNode,tostring(username)) 
    else 
        xmlCreateChild(xmlFile,"players") 
    end 
end) 

This code gives two WARNING: Bad argument errors:

Bad argument @ 'xmlNodeFindChild' - line: 5

Bad argument @ 'xmlCreateChild' - line: 9

Someone can help me with this?

Link to comment

Meta file:

<meta> 
    <info author="Cornelis" type="script"/> 
     
    <file src="players.xml"/> 
    <script src="gui_s.lua" type="server"/> 
    <script src="gui.lua" type="client"/> 
</meta> 

Players xml

<players> 
</players> 

//EDIT: It don't show any errors anymore but It don't make a subnode in players.xml

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...