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

25
LINES

< > BotCompany Repo | #525 // de.tinybrain.nt.nt01.ExecuteReplacement

Java source code

package de.tinybrain.nt.nt01;

import net.luaos.tb.remote.ServerConnection;
import net.luaos.tb.tb12.Sandbox;
import org.luaj.vm2.LuaValue;

import java.io.IOException;

public class ExecuteReplacement {
  public static void main(String[] args) throws IOException {
    String replacementID = "#2000029";
    String contentID = "#2000028";
    String replacerID = "#2000031";

    ServerConnection serverConnection = ServerConnection.aServerConnection();
    Sandbox sandbox = new Sandbox(serverConnection);
    sandbox.setOuter("replacement", serverConnection.loadSnippet(replacementID));
    sandbox.setOuter("content", serverConnection.loadSnippet(contentID));
    LuaValue result = sandbox.runSnippet(replacerID);
    String textResult = result.tojstring();
    System.out.println("Result: " + textResult);
    String title = "A result for replacement " + replacementID + " on " + contentID + " using replacer " + replacerID;
    System.out.println("Snippet created: " +serverConnection.ntUpload(textResult, ExecuteReplacement.class.getName(), title));
  }
}

download  show line numbers   

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

No comments. add comment

Snippet ID: #525
Snippet name: de.tinybrain.nt.nt01.ExecuteReplacement
Eternal ID of this version: #525/1
Text MD5: c6396e37da10bee9a4b49211e0411709
Author: stefan
Category:
Type: Java source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-03-12 21:19:42
Source code size: 1088 bytes / 25 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 548 / 131
Referenced in: [show references]