Can anyone point out if I'm doing something wrong? I swear this shouldn't be happening.
Basically...
* I have a function that returns a 'type' that I have defined in a methodmap.
* I use one of its methods on it.
* That method has a default parameter in it.
* If I leave that parameter blank, the values of "this" and the default parameter seem to switch.
PHP Code:
methodmap Calculator {
public Calculator(int id){
return view_as<Calculator>(id);
}
public int Add(int a, int b = 666){
PrintToServer("B = %i", b);
PrintToServer("CALC ID = %i", this);
return a + b;
}
}
public void OnPluginStart(){
Calculator(42).Add(2, 3);
Calculator(42).Add(2);
}
Result:
HTML Code:
B = 3 // expected 3
CALC ID = 42 // expected 42
B = 42 // expected 666
CALC ID = 666 // expected 42
Please let me know if I'm being stupid. Otherwise I can report a bug. Thank you!