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).

!7

static O obj;

concept Obj {
  S structure;
}

p {
  db();
  loadObj();
  bot();
}

svoid loadObj {
  obj = null;
  Obj o = findConcept(Obj);
  if (o != null)
    obj = unstructure(o.structure);
}

svoid setObj(O newObj) {
  cset(uniq(Obj), structure := structure(newObj));
  loadObj();
}

sS haveMsg() {
  ret "Have object of type " + getClassName(obj);
}

answer {
  if (startsWith(s, "!string =", m)) {
    S newObj = unquoteIfProperlyQuoted(trim($1));
    setObj(newObj);
    ret haveMsg();
  }
  
  if (eq(s, "!obj"))
    ret haveMsg();
    
  if (eq(s, "!structure"))
    ret structure(obj);
    
  if (startsWithWord(s, "!op", m)) {
    S functionName = unquote($1);
    O newObj = makeAndCall(functionName, obj);
    setObj(newObj);
    ret haveMsg();
  }
}

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