Yes, use a value that you can modify destructively.
void foo(mapping m) { m->s=m->s+"!"; }
void main() { mapping m=(["s":"Hello World"]); foo(m); write(m->s+"\n"); }
/ Mirar
Previous text:
12527646 2004-11-03 19:54 /14 lines/ Peter Lundqvist (disjunkt) Recipients: Pike (-) help Subject: call by reference
I was under the impression that call by reference was default in pike, but it seems I've lived a lie. Is there a way to write
void foo(string s) { s=s+"!"; }
void main() { string a = "Hello World"; foo(a); write(a+"\n"); }
without returning a string from foo?
(12527646) /Peter Lundqvist (disjunkt) /----------------------------