Jump to content

ASCII checking


Recommended Posts

Posted

why it dont work?

function checkifcorrectpw (pw) 
for i = 32, 255, 1 do 
    if i < 49 or i > 57 and i < 65 or i > 95 and i < 97 or i > 122 then 
        if string.find (pw, string.char (i), 1, true) then 
            break    
            return true 
        elseif  i == 255 and not string.find (pw, string.char (i), 1, true) then 
            return false 
        end 
    end 
end 
end 

Posted

'break' keyword escapes the loop at the point it's reached, preventing the code execution from reaching the 'return true' line.

Posted

In other words you just have to swap and flip break with return true or simply remove 'break' since its not necessary due to the return..

Posted
function checkifcorrectpw (pw) 
for i = 32, 255, 1 do 
    if i < 49 or i > 57 and i < 65 or i > 95 and i < 97 or i > 122 then 
        if string.find (pw, string.char (i), 1, true) then 
                    return true 
            break    
        elseif  i == 255 and not string.find (pw, string.char (i), 1, true) then 
            return false 
        end 
    end 
end 
end 

Dont work error: Loaddin script failed ... end expected ( to close if at 6) near break?

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