Skip to content

Commit a6dc419

Browse files
authored
Add files via upload
1 parent 4ea615d commit a6dc419

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

com/devkev/devscript/nativecommands/NativeLibrary.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,9 @@ public Object execute(Object[] args, Process application, Block block) throws Ex
679679
if(args.length == 0) {
680680
application.log(String.format("%-40s%s", "SYNTAX EXAMPLE", "DESCRIPTION"), true);
681681
application.log("", true);
682+
application.log("Listeners", true);
683+
application.log("onexit = {}; Fires when the application is finished. Useful for closing sockets etc.", true);
684+
application.log("", true);
682685
int maxLength = 0;
683686
for(GeneratedLibrary lib : application.getLibraries()) {
684687
application.log("\nLIBRARY: '" + lib.name + "' (" + lib.commands.length + (lib.commands.length > 1 ? " commands)\n" : " command)\n"), true);

com/devkev/devscript/raw/Process.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,19 @@ private void start(Block block) {
258258
// }
259259
// }
260260

261+
//Searches for a variable called onexit with the type BLOCK
262+
263+
264+
265+
if(block.equals(main) && listener != null) {
266+
Object exitFunction = getVariable("onexit", null);
267+
268+
if(exitFunction != null)
269+
executeBlock(((Block) exitFunction), true);
270+
271+
listener.done(main.exitCode);
272+
}
261273
block.alive = false;
262-
if(block.equals(main) && listener != null) listener.done(main.exitCode);
263274
aliveBlocks.remove(block);
264275
}
265276

com/devkev/gui/Window.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public class Window {
7272

7373
private static Font font;
7474
private File openedFile = null; //Null means, creating a new file when saving.
75-
private static final String TITLE = "Devscript 1.9.0 Editor (Alpha)";
75+
private static final String TITLE = "Devscript 1.9.3 Editor ";
7676
private ArrayList<String> history = new ArrayList<String>();
7777
private int historyIndex = 0;
7878
public int maxHistorySize = 50;

0 commit comments

Comments
 (0)