Skip to content

Repository files navigation

Starscript

Fast text formatting language for Java.

  • Lightweight with no dependencies
  • Faster than String.format (See Benchmark)
  • Standard operators + - * / % ^
  • Bitwise operators & | ~ << >> >>> ^^
  • Ability to call functions defined in java
  • Variables can be different each time they are used
  • Conditional output (ternary operator)
  • Variables can be maps

Examples

  • Hello {name}!
  • Number: {someNumber * 100}
  • FPS: {round(fps)}
  • Today is a {good ? 'good' : 'bad'} day
  • Name: {player.name}

Usage

Gradle:

repositories {
maven {
name ="meteor-maven"
url ="https://maven.meteordev.org/releases"
}
}
dependencies {
implementation "org.meteordev:starscript:0.2.5"
}

Java:

// ParseParser.Resultresult = Parser.parse("Hello {name}!");
// Check for errorsif (result.hasErrors()) {
for (Errorerror : result.errors) System.out.println(error);
return;
}
// CompileScriptscript = Compiler.compile(result);
// Create starscript instanceStarscriptss = newStarscript();
StandardLib.init(ss); // Adds a few default functions, not requiredss.set("name", "MineGame159");
// ss.set("name", () -> Value.string("MineGame159"));// RunSystem.out.println(ss.run(script)); // Hello MineGame159!

Documentation

Full syntax and features can be found on wiki.
Javadocs can be found here.

About

Fast text formatting language for Java.

Resources

Stars

55 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages