We are about to switch to a new forum software. Until then we have removed the registration on this forum.
So like let's say I have a string, and it's set to "login", how would I call the function login() from that string. Also it needs parameters.
The function I am using is:
boolean login(String username, String password) {
Object[] usernames = users.keys().toArray();
boolean success = false;
for(Object i: usernames) {
if(i.equals(username)) {
JSONObject user = users.getJSONObject((String)i);
if(password.equals(user.getString("password"))) {
success = true;
}
}
}
return success;
}
Answers
https://Forum.Processing.org/two/discussions/tagged?Tag=method()
I know about method(), It's just that I can't give the function any parameters. And also I need the return value of the function too.
As a workaround, why don't you try out
switch () / case:
instead?Here's a similar online example: O:-)
http://Studio.ProcessingTogether.com/sp/pad/export/ro.9eDRvB4LRmLrr
Thank you! :D