Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added method for setting custom bindings in ModelScript. #1

Merged
merged 1 commit into from Jun 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/main/java/com/simsilica/jmec/ModelScript.java
Expand Up @@ -92,6 +92,20 @@ public String getScriptName() {
return scriptName;
}

/**
* Sets a variable that will be available to the script.
*/
public void setBinding( String name, Object value ) {
bindings.put( name, value );
}

/**
* Returns a variable that is available to the scripts.
*/
public Object getBinding( String name ) {
return bindings.get(name);
}

public static final String loadScript( String scriptName ) {
File f = new File(scriptName);
if( f.exists() ) {
Expand Down