Lloyd Logan Posted January 3, 2014 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 If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
xXMADEXx Posted January 3, 2014 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 The Ultimate Lua Tutorial! | MTA PHP SDK
Lloyd Logan Posted January 3, 2014 Author Posted January 3, 2014 (edited) It works! But, can you explain gsub Edited January 3, 2014 by Guest If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
xXMADEXx Posted January 3, 2014 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 The Ultimate Lua Tutorial! | MTA PHP SDK
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