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

19
LINES

< > BotCompany Repo | #1010956 // chatLinesAsWeb2

JavaX fragment (include)

1  
// a, b are indices into the chat history
2  
static Web chatLinesAsWeb2(int a, int b, O makeNode) {
3  
  ret chatLinesAsWeb2(stefansChat_readHistory_fullMsgs(a, b), makeNode);
4  
}
5  
6  
// makeNode: voidfunc(ChatMsg, WebNode)
7  
static Web chatLinesAsWeb2(L<ChatMsg> msgs, O makeNode) {
8  
  Web web = simpleWeb();
9  
  new L<WebNode> nodes;
10  
  for i over msgs: {
11  
    ChatMsg msg = msgs.get(i);
12  
    WebNode n = web.newNode();
13  
    web_addRelation(last(nodes), n, 'then);
14  
    web_setPosition(n, 0.5, 0.2+i*0.6/max(1, l(msgs)-1));
15  
    nodes.add(n);
16  
    pcallF(makeNode, msg, n);
17  
  }
18  
  ret web;
19  
}

Author comment

Began life as a copy of #1010919

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: #1010956
Snippet name: chatLinesAsWeb2
Eternal ID of this version: #1010956/6
Text MD5: bb0d94bc2262bb10c1dffbf06c340e9b
Author: stefan
Category: javax / chat / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-10 18:41:35
Source code size: 587 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 424 / 430
Version history: 5 change(s)
Referenced in: [show references]