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)

// returns list(pair(id, rule))
static L<PairS> mL_rules_addGlobalIDsIfAuthed(S listName) {
  L<S> l = splitAtEmptyLines(mL_raw(listName));
  L<PairS> withIDs = combineWithGlobalIDs(l);
  bool change = false;
  for (PairS p : withIDs)
    if (empty(p.a)) { p.a = aGlobalID(); change = true; }
  if (change && isMechAuthed()) {
    S newText = joinWithEmptyLines(map(withIDs, func(PairS p) -> S {
      prependGlobalIDInNewLineAndIndent(p.a, p.b) }));
    editMechList(listName, newText);
  }
  ret withIDs;
}

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: 269 / 316
Version history: 5 change(s)
Referenced in: [show references]