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

14
LINES

< > BotCompany Repo | #1017655 // mL_rules_addGlobalIDsIfAuthed

JavaX fragment (include)

1  
// returns list(pair(id, rule))
2  
static L<PairS> mL_rules_addGlobalIDsIfAuthed(S listName) {
3  
  L<S> l = splitAtEmptyLines(mL_raw(listName));
4  
  L<PairS> withIDs = combineWithGlobalIDs(l);
5  
  bool change = false;
6  
  for (PairS p : withIDs)
7  
    if (empty(p.a)) { p.a = aGlobalID(); change = true; }
8  
  if (change && isMechAuthed()) {
9  
    S newText = joinWithEmptyLines(map(withIDs, func(PairS p) -> S {
10  
      prependGlobalIDInNewLineAndIndent(p.a, p.b) }));
11  
    editMechList(listName, newText);
12  
  }
13  
  ret withIDs;
14  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017655
Snippet name: mL_rules_addGlobalIDsIfAuthed
Eternal ID of this version: #1017655/6
Text MD5: 7bda91ee5314bb52d383b2afc53fa602
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-27 12:51:50
Source code size: 521 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 272 / 319
Version history: 5 change(s)
Referenced in: [show references]