static synchronized S manageStringList(S s, S name, S varName, boolean canChange) { L list = (L) get(main.class, varName); new Matches m; if (match("list " + plural(name), s)) ret structure(list); if (match("how many " + plural(name), s)) ret str(l(list)); if (match("add " + name + " *", s, m)) { if (!canChange) ret "Sorry. Not authorized"; S id = m.unq(0); list.add(id); save(varName); ret "OK, " + name + " " + quote(id) + " added. List size now: " + l(list); } if (match("remove " + name + " *", s, m)) { if (!canChange) ret "Sorry. Not authorized"; S id = m.unq(0); int idx = list.indexOf(id); if (idx < 0) ret id + " is not a " + name; list.remove(idx); save(varName); ret "OK, " + name + " " + quote(id) + " removed. List size now: " + l(list); } ret null; }