Created
July 25, 2012 01:20
-
-
Save morgant/3173823 to your computer and use it in GitHub Desktop.
NewtonScript Perform() for NEWT/0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Send a message to a method in a frame by name with an array of parameters | |
* | |
* @param rcvr [in] レシーバ | |
* @param frame [in] Frame | |
* @param message [in] Message | |
* @param params [in] Parameters | |
* | |
* @return Return value | |
*/ | |
newtRef NsPerform(newtRefArg rcvr, newtRefArg frame, newtRefArg message, newtRefArg params) | |
{ | |
newtRef ary = NewtRefIsNIL(params) ? NewtMakeArray(kNewtRefUnbind, 0) : params; | |
return NcSendWithArgArray(frame, message, false, ary); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!newt | |
someFrame := { SomeMethod: func() begin | |
Print("SomeMethod!"); | |
end, | |
SomeOtherMethod: func(number) begin | |
Print("SomeOtherMethod(" & number & ")!"); | |
end | |
}; | |
// test Perform() with no arguments to be passed with the message | |
Perform(someFrame, 'SomeMethod, nil); | |
// test Perform() with an argument passed with the message | |
Perform(someFrame, 'SomeOtherMethod, [42]); | |
true; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment