[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Swarm-Support] Selectors
From: |
Steve Jackson |
Subject: |
Re: [Swarm-Support] Selectors |
Date: |
Wed, 09 Jul 2003 07:53:18 -0700 |
Try something like this:
- setPayoff: (float *) p
{
payoff = *p;
return self;
}
float pay=10.1;
[group forEach: M(setPayoff:): (void *) &pay ];
or
float* pay;
pay = (float *) [whateverZone alloc: sizeof(float)];
*pay = 10.1;
[group forEach: M(setPayoff:): (void *) pay ];
Free up the memory allocation when you're done with pay:
[whateverZone free: pay];
Marcello wrote:
> Pardon me the frequency of my questions!
>
> I have a method in a class Agent:
>
> - setPayoff: (float) p {
>
> payoff=p;
>
> return self;
> }
>
> Now, in another class, I have a List of Agent called "group". I'd like
> to pass through the list and set the payoff as follows:
> float pay=10.1;
> [group forEach: M(setPayoff:): pay ];
>
> If I do that, I get
> gcc: incompatible type for argument 4 of indirect function call
>
> if I set
> [group forEach: M(setPayoff:): (id) pay ];
> id does not work either,
>
> it only works if :
> [group forEach: M(setPayoff:): (int) pay ];
>
> but then pay is always zero.
>
> Any help?
> thanks
> marcello
> --
> Marcello Gallucci (Ph.D)
> Department of Social Psychology
> Free University
> Van der Boechorststraat 1
> 1081 BT Amsterdam (NL)
> Tel. +31(0)20 4448846
> Fax +31 (0)20 4448921
> _______________________________________________
> Support mailing list
> address@hidden
> http://www.swarm.org/mailman/listinfo/support
- RE: [Swarm-Support] Error in install (RH 7.1), (continued)
- RE: [Swarm-Support] Error in install (RH 7.1), Agustin Ramos Fonseca, 2003/07/03
- Re: [Swarm-Support] Error in install (RH 7.1), Paul Johnson, 2003/07/04
- [Swarm-Support] binary numbers, Marcello, 2003/07/08
- Re: [Swarm-Support] binary numbers, Russell Standish, 2003/07/08
- Re: [Swarm-Support] binary numbers, Marcello, 2003/07/08
- Re: [Swarm-Support] binary numbers, Russell Standish, 2003/07/08
- [Swarm-Support] Selectors, Marcello, 2003/07/09
- Re: [Swarm-Support] Selectors, Paul Johnson, 2003/07/09
- Re: [Swarm-Support] Selectors, Marcello, 2003/07/09
- Re: [Swarm-Support] Selectors, Paul Johnson, 2003/07/09
- Re: [Swarm-Support] Selectors,
Steve Jackson <=
- Re: [Swarm-Support] binary numbers, Paul Johnson, 2003/07/08