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

50
LINES

< > BotCompany Repo | #1008272 // Perform operations on objects bot

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (8444L/57K/186K).

1  
!7
2  
3  
static O obj;
4  
5  
concept Obj {
6  
  S structure;
7  
}
8  
9  
p {
10  
  db();
11  
  loadObj();
12  
  bot();
13  
}
14  
15  
svoid loadObj {
16  
  obj = null;
17  
  Obj o = findConcept(Obj);
18  
  if (o != null)
19  
    obj = unstructure(o.structure);
20  
}
21  
22  
svoid setObj(O newObj) {
23  
  cset(uniq(Obj), structure := structure(newObj));
24  
  loadObj();
25  
}
26  
27  
sS haveMsg() {
28  
  ret "Have object of type " + getClassName(obj);
29  
}
30  
31  
answer {
32  
  if (startsWith(s, "!string =", m)) {
33  
    S newObj = unquoteIfProperlyQuoted(trim($1));
34  
    setObj(newObj);
35  
    ret haveMsg();
36  
  }
37  
  
38  
  if (eq(s, "!obj"))
39  
    ret haveMsg();
40  
    
41  
  if (eq(s, "!structure"))
42  
    ret structure(obj);
43  
    
44  
  if (startsWithWord(s, "!op", m)) {
45  
    S functionName = unquote($1);
46  
    O newObj = makeAndCall(functionName, obj);
47  
    setObj(newObj);
48  
    ret haveMsg();
49  
  }
50  
}

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: #1008272
Snippet name: Perform operations on objects bot
Eternal ID of this version: #1008272/6
Text MD5: c6a7dff347f24867b94c0eca0cdca312
Transpilation MD5: 45356ebf6be0e539336d5090a9a46ae1
Author: stefan
Category: javax / slack bots
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-06 15:36:49
Source code size: 818 bytes / 50 lines
Pitched / IR pitched: No / No
Views / Downloads: 495 / 616
Version history: 5 change(s)
Referenced in: [show references]