Lloyd Logan Posted January 3, 2014 Share Posted January 3, 2014 Why does this say there is no text in the editbox even if there is? function checkRegField() inputusernamereg = guiGetText(GUIEditor.edituserreg) inputpasswordreg = guiGetText(GUIEditor.editpassreg) if inputusernamereg or inputpasswordreg == "" then guiSetVisible (GUIEditor.window[2], true ) guiBringToFront ( GUIEditor.window[2] ) else triggerServerEvent("submitRegister", getRootElement(), inputusernamereg, inputpasswordreg) end end Link to comment
xXMADEXx Posted January 3, 2014 Share Posted January 3, 2014 Try this: function checkRegField() local inputusernamereg = guiGetText(GUIEditor.edituserreg) local inputpasswordreg = guiGetText(GUIEditor.editpassreg) if inputusernamereg:gsub ( " ", "" ) == "" or inputpasswordreg:gsub ( " ", "" ) == "" then guiSetVisible (GUIEditor.window[2], true ) guiBringToFront ( GUIEditor.window[2] ) else triggerServerEvent("submitRegister", localPlayer, inputusernamereg, inputpasswordreg) end end Link to comment
Lloyd Logan Posted January 3, 2014 Author Share Posted January 3, 2014 (edited) It works! But, can you explain gsub Edited January 3, 2014 by Guest Link to comment
xXMADEXx Posted January 3, 2014 Share Posted January 3, 2014 It works! But, can you explain gsub gsub is part of string.gsub... It will find arg1 (In this case " ") and replace it with arg2 (In this case ""). In this script, it will remove all the spaces. http://www.lua.org/manual/5.1/manual.ht ... tring.gsub Link to comment
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