Package meteordevelopment.starscript
Class Starscript
java.lang.Object
meteordevelopment.starscript.Starscript
A VM (virtual machine) that can run compiled starscript code,
Script.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThrows aStarscriptError.voidgetCompletions(String source, int position, CompletionCallback callback) Calls the provided callback for every completion that is able to be resolved from global variables.Returns the underlyingValueMapfor global variables.peek()Returns a value from the stack without removing it.peek(int offset) Returns a value from the stack with an offset without removing it.pop()Pops a new value from the stack.booleanPops a value from the stack and returns it as boolean.doublePops a value from the stack and returns it as double.Pops a value from the stack and returns it as String.voidPushes a new value on the stack.Runs the script.run(Script script, StringBuilder sb) Runs the script and fills the providedStringBuilder.Sets a boolean variable supplier that always returns the same value for the provided name.Sets a number variable supplier that always returns the same value for the provided name.Sets a string variable supplier that always returns the same value for the provided name.Sets a variable supplier for the provided name.Sets a function variable supplier that always returns the same value for the provided name.Sets a variable supplier that always returns the same value for the provided name.Sets a map variable supplier that always returns the same value for the provided name.
-
Constructor Details
-
Starscript
public Starscript()
-
-
Method Details
-
run
Runs the script and fills the providedStringBuilder. ThrowsStarscriptErrorif a runtime error happens. -
run
Runs the script. ThrowsStarscriptErrorif a runtime error happens. -
push
Pushes a new value on the stack. -
pop
Pops a new value from the stack. -
peek
Returns a value from the stack without removing it. -
peek
Returns a value from the stack with an offset without removing it. -
popBool
Pops a value from the stack and returns it as boolean. Callserror(String, Object...)with the provided message if the value is not boolean. -
popNumber
Pops a value from the stack and returns it as double. Callserror(String, Object...)with the provided message if the value is not double. -
popString
Pops a value from the stack and returns it as String. Callserror(String, Object...)with the provided message if the value is not String. -
error
Throws aStarscriptError. -
set
Sets a variable supplier for the provided name. -
set
Sets a variable supplier that always returns the same value for the provided name. -
set
Sets a boolean variable supplier that always returns the same value for the provided name. -
set
Sets a number variable supplier that always returns the same value for the provided name. -
set
Sets a string variable supplier that always returns the same value for the provided name. -
set
Sets a function variable supplier that always returns the same value for the provided name. -
set
Sets a map variable supplier that always returns the same value for the provided name. -
getGlobals
Returns the underlyingValueMapfor global variables. -
getCompletions
Calls the provided callback for every completion that is able to be resolved from global variables.
-