Skip to content
This repository has been archived by the owner on Oct 30, 2021. It is now read-only.
/ Zeus Public archive

A custom scripting language designed to be used inside of Java.

Notifications You must be signed in to change notification settings

Arraying/Zeus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zeus

A custom scripting language

Zeus

Zeus is a custom scripting language designed to be embedded into Java code to allow users to execute scripts in an enviroment that is fully manageable by the developer(s).

Usage

Simply add the library as a dependency. Replace {version} with the version you would like, a list can be found here.

Maven

  <repositories>
    <repository>
      <id>jitpack.io</id>
      <url>https://jitpack.io</url>
    </repository>
  </repositories>
  <dependencies>
    <dependency>
      <groupId>com.github.Arraying</groupId>
      <artifactId>Zeus</artifactId>
      <version>{version}</version>
    </dependency>
  </dependencies>

Gradle

  repositories {
    maven { 
      url 'https://jitpack.io' 
    }
  }
  dependencies {
    compile 'com.github.Arraying:Zeus:{version}'
  }

Code

It's fairly forward creating the things inside of java. The documented version of the example can be found here. The file mentioned, example.zeus, can be found here.

package de.arraying.zeus;

import de.arraying.zeus.backend.ZeusException;
import de.arraying.zeus.backend.annotations.ZeusMethod;
import de.arraying.zeus.runtime.ZeusRuntime;
import de.arraying.zeus.runtime.ZeusRuntimeBuilder;
import de.arraying.zeus.runtime.ZeusTask;
import de.arraying.zeus.utils.ZeusVariableUtil;
import de.arraying.zeus.variable.VariableType;

import java.io.File;

public class Example {

    @ZeusMethod
    public void show_my_variable(String variableValue) {
        System.out.println("My variable's value is: " + variableValue + "!");
    }

    public static void main(String[] args) {
        try {
            ZeusRuntimeBuilder builder = new ZeusRuntimeBuilder(ZeusRuntimeBuilder.Configuration.STANDARD);
            builder.withMethods(new Example());
            builder.withVariables(ZeusVariableUtil.createVariable(VariableType.CONSTANT, "my_var", "My Variable"));
            ZeusRuntime runtime = builder.build();
            ZeusTask task = runtime.evaluate(new File("example.zeus"), Throwable::printStackTrace);
        } catch(ZeusException exception) { // Exceptions can occur during the building process, too.
            exception.printStackTrace();
        }
    }

}

Information

For information concering the actual language please visit the wiki. All methods are documented, a JavaDoc is coming soon.

Development

Zeus is still in heavy development and no where near complete. Should you fix any bugs or add features please make a pull request.

About

A custom scripting language designed to be used inside of Java.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages