call method with variable nr of arguments

20 views
Skip to first unread message

GiddeonZeix

unread,
Jan 18, 2010, 7:34:36 PM1/18/10
to F-Script
Hello everybody

i wonder if it is possible to call a method defined in Obj-C
for example NSString stringWithFormat , from F-Script

for example:

nrOfItems := 99
myString := NSString stringWithFormat:'i count %d items',nrOfItems

it works with only one parameter like:
myString := NSString stringWithFormat:'i count %d items'

but i would like to pass multiple parameters

some cocoa classes have such methods

does someone know how to do this ?

thank you in advance

Ken Ferry

unread,
Jan 19, 2010, 3:18:50 AM1/19/10
to f-sc...@googlegroups.com
Hi Giddeon,

No, F-Script doesn't support calling methods that take a variable number of arguments at the moment.

For formatting you can use the ++ string concatenation operator:

> myString := 'I count ' ++ (nrOfItems description) ++ ' items'


Getting a little fancier, you could consider the following if you thought it read better:

> {'I count ', nrOfItems, ' items'} @ description \#++


-Ken

--
You received this message because you are subscribed to the Google Groups "F-Script" group.
To post to this group, send email to f-sc...@googlegroups.com.
To unsubscribe from this group, send email to f-script+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/f-script?hl=en.




Reply all
Reply to author
Forward
0 new messages