Drakath Posted December 24, 2013 Posted December 24, 2013 I'm getting stack overflow error. It happened when I made this function: function savePass() local xmlFile = xmlLoadFile(xmlFileName) if guiCheckBoxGetSelected(PasswordSave) then xmlNodeSetAttribute(xmlFile,"password",tostring(guiGetText(editPassword))) xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) elseif not guiCheckBoxGetSelected(PasswordSave) then xmlNodeSetAttribute(xmlFile,"password","") xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end end addEventHandler("onClientGUIClick",btnLogin,savePass) It says that the error is on line 285 which is: xmlSaveFile(xmlFile) function xmlFileHandler(gReturn) local xmlFile = xmlLoadFile(xmlFileName) if not xmlFile then xmlFile = xmlCreateFile(xmlFileName,"settings") end xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) if (gReturn) then if (gReturn == true) then loginPanel() else return end end end
Castillo Posted December 24, 2013 Posted December 24, 2013 On which function is the stack overflow appearing? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Drakath Posted December 24, 2013 Author Posted December 24, 2013 xmlFileHandler but it happened when I made savePass
Castillo Posted December 24, 2013 Posted December 24, 2013 When are you executing: "xmlFileHandler"? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Drakath Posted December 24, 2013 Author Posted December 24, 2013 When they join to check if they have a settings.xml file and when they click the login button.
Castillo Posted December 24, 2013 Posted December 24, 2013 Can you post the parts where it executes it? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Drakath Posted December 24, 2013 Author Posted December 24, 2013 How can this help? The error appeared when I made savePass function and I also noticed that it works if I change this: function savePass() local xmlFile = xmlLoadFile(xmlFileName) if guiCheckBoxGetSelected(PasswordSave) then xmlNodeSetAttribute(xmlFile,"password",tostring(guiGetText(editPassword))) xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) elseif not guiCheckBoxGetSelected(PasswordSave) then xmlNodeSetAttribute(xmlFile,"password","") xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end end into this: function savePass() local xmlFile = xmlLoadFile(xmlFileName) if guiCheckBoxGetSelected(PasswordSave) then xmlNodeSetAttribute(xmlFile,"password",tostring(guiGetText(editPassword))) xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end end However the password will always be saved if I do this. I need it to set the password to "" when checkbox is unchecked.
Castillo Posted December 24, 2013 Posted December 24, 2013 function savePass ( ) local xmlFile = xmlLoadFile ( xmlFileName ) local pass = ( guiCheckBoxGetSelected ( PasswordSave ) and tostring ( guiGetText ( editPassword ) ) or "" ) xmlNodeSetAttribute ( xmlFile, "password", pass ) xmlSaveFile ( xmlFile ) xmlUnloadFile ( xmlFile ) end Try that one. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted December 25, 2013 Posted December 25, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now