Dreft Posted March 27, 2019 Share Posted March 27, 2019 Im using async version of the function passVerify. How to pass some parameters to callback which is called after passVerify function completes? As for now I have: function someFunction() passwordVerify( password, hashedPassword, {}, passVerificationComplete ) end function passVerificationComplete(matched) if matched then -- passwords matched else -- passwords mismatch end end in "passVerificationComplete" parameter "matched" is the value which is true or false, depends on what passwordVerify returned, how to pass some other parameters to passVerificationComplete callback? Something like this: function someFunction() passwordVerify( password, hashedPassword, {}, passVerificationComplete(someOtherParam) ) end function passVerificationComplete(matched, someOtherParam) if matched then outputDebugString(someOtherParam) -- passwords matched else -- passwords mismatch end end Link to comment
TRtam Posted March 27, 2019 Share Posted March 27, 2019 This is the first idea that came to my mind, maybe is there more useful ways to do it. function someFunction() passwordVerify( password, hashedPassword, {}, function(matched) passVerificationComplete(matched, someOtherParam) end ) end function passVerificationComplete(matched, someOtherParam) if matched then outputDebugString(someOtherParam) -- passwords matched else -- passwords mismatch end end 1 Link to comment
Dreft Posted March 27, 2019 Author Share Posted March 27, 2019 Thanks a lot. Works like a charm 1 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