performWithDelay doesn't seem to be working

I am trying to write a mock log in while developing my app so I don’t have to actually ping my servers. I wanted to delay the log in to make it look like it was waiting for a response from the server. For some reason, the M:logInUser function is returning immediately and doesn’t return the true/false like I was expecting.

Is there an error with the performWithDelay that is keeping it from delaying? Also, does the callback function not return the boolean? Any help would be greatly appreciated.

local function mockLogIn( email, pass )     for \_, user in ipairs(mockUsers.data) do         if (email == user.email and pass == user.password) then             return true         end     end     return false end function M:logInUser( email, pass )     return timer.performWithDelay( 2000, mockLogIn(email, pass)) end

Passing in a full function call to timer.performWithDelay results in the function being called immediately.

Try something like the below:

function M:logInUser( email, pass ) return timer.performWithDelay( 2000, function() mockLogIn(email, pass) end,1) end

There are other techniques of accomplishing the above in the docs:

https://docs.coronalabs.com/api/library/timer/performWithDelay.html

Passing in a full function call to timer.performWithDelay results in the function being called immediately.

Try something like the below:

function M:logInUser( email, pass ) return timer.performWithDelay( 2000, function() mockLogIn(email, pass) end,1) end

There are other techniques of accomplishing the above in the docs:

https://docs.coronalabs.com/api/library/timer/performWithDelay.html