Skip to content

Instantly share code, notes, and snippets.

@morgant morgant/NewtFns.c
Created Jul 25, 2012

What would you like to do?
NewtonScript Perform() for NEWT/0
/** 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);
someFrame := { SomeMethod: func() begin
SomeOtherMethod: func(number) begin
Print("SomeOtherMethod(" & number & ")!");
// 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]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.