Joy Online Manual
NAME |
self - Current interpreter |
SYNOPSIS |
self
DESCRIPTION |
The Joy JavaScript framework includes an Objective-C class ITKJSInterp that wraps the functionality of the JavaScript C API in an Objective-C class. Its most important method is eval: which evaluates its argument as JavaScript code and returns the result.
The JavaScript global variable self points to the ITKJSInterp instance that represents the current interpreter. Do not confuse this global self with the hidden parameter self that points to the target of the current message inside method implementations. Tip: To access the current interpreter or any other global variable that is shadowed by a parameter or instance variable from inside a method, write at global scope: |
global = this;
Then you can access any global variable from inside your methods with: |
global.var
EXAMPLE |
js> self
(ITKJSInterp *)0x277958
js> [self eval: "2 + 2"]
4
SEE ALSO |
Index |