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

13
LINES

< > BotCompany Repo | #1021961 // dm_discord_contextAroundLine - uses unimported lines

JavaX fragment (include)

1  
static L dm_discord_contextAroundLine(long msgID, int i, int j) {
2  
  ret dm_discord_contextAroundLine(dm_call(dm_gazelle_linesCRUD(), 'lineForID, msgID), i, j);
3  
}
4  
5  
static L dm_discord_contextAroundLine(O line, int i, int j) {
6  
  if (line == null) null;
7  
  long channelID = toLong(call(line, 'channelID));
8  
  if (channelID == 0) null;
9  
  L lines = cast dm_call(dm_gazelle_linesCRUD(), 'linesInChannel, channelID);
10  
  int idx = indexOf(lines, line);
11  
  if (idx < 0) ret null with print("Line not found in channel " + channelID);
12  
  ret subList(lines, idx+i, idx+j);
13  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021961
Snippet name: dm_discord_contextAroundLine - uses unimported lines
Eternal ID of this version: #1021961/2
Text MD5: 5bf0b2f36ad54c8f0b58654c518e2174
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-04 11:04:47
Source code size: 569 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 249 / 287
Version history: 1 change(s)
Referenced in: [show references]