Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1002617 // confirm - have action confirmed by user before executing

JavaX fragment (include)

1  
static class Confirm extends Status {
2  
  O responder; // must contain an answer function
3  
  
4  
  *() {}
5  
  *(O *responder) {}
6  
  
7  
  S answer(S s) {
8  
    status(null); // always forget question after one line
9  
    
10  
    if (isYes(s))
11  
      ret callAnswerMethod(responder, s);
12  
    else if (isNo(s))
13  
      ret "OK, cancelled";
14  
    null;
15  
  }
16  
}
17  
18  
static S confirm(S msg, O responder) {
19  
  status(new Confirm(responder));
20  
  ret msg;
21  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1002617
Snippet name: confirm - have action confirmed by user before executing
Eternal ID of this version: #1002617/1
Text MD5: 0c015eedf8e37d5647ba82e5bc173063
Author: stefan
Category: eleu
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-02-05 21:08:30
Source code size: 439 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 596 / 550
Referenced in: [show references]