How to create/change local and global varibles from Executor?
miresru opened this issue ยท 2 comments
How I can create or change local or global varible from Executor?
For example I have script:
{"myobj.myvar"} = "some data"
#TEST "new data"
#LOG {"myobj.myvar"}
How I can change myobj.myvar
in TEST.js?
I found sollution, but I am not sute it's right one.
Script file:
{"myobj.myvar"} = "some data"
#TEST "NEW DATA"
#LOG {"myobj.myvar"}
TEST.js
function TEST(args){
plugin.getVariableManager().put("myobj.myvar",args[0]);
- to set global var
plugin.getVariableManager().saveAll();
- to save vars to file
var v = plugin.getVariableManager().get("myobj.myvar");
- to get global var
print("v="+v);
- print it to console
return null;
}
For all other methods look here: VariableManager