OSL ‐ this and local data - Mistium/Origin-OS GitHub Wiki
About Variables
In osl all variables are global scope and to use locally scoped variables you must use the keyword this
this
?
Where can i use You can use this
inside of the following scopes
def
method
main
run
this
work?
How does The this
variable is a json object that can be modified by setting keys on it, as shown below
this.key = "1234"
log this
// returns {"key":"1234"}
this
has a different value depending on the scope of when you access it
Example script
def "test_cmd"
this.hello = "greetings!"
log this.hello
// logs "greetings!"
endef
this.hello = "hello world"
test_cmd
log this.hello
// logs "hello world"