My question is related to this one:
Can a contract function both change the state and return a value when it's called externally
Question: How to read event/log content?
I have a contract like:
contract Aa {
uint state;
event CheckVal(bool value);
function test() returns (bool ){
bool temp=true;
CheckVal(temp);
state= 5;
return temp;
}
}
I want to both change the state and get the returned value: "temp". I'm following the guide from here (the 1st usecase).
The problem is that when in my geth console, I put
exampleEvent.watch(function(err, result) {
if (err) {
console.log(err)
return;
}
console.log(result.args.temp)
})
only three dots will appear(i.e. ...), so I cannot get the value I want and I cannot send a transaction to the private chain and see the returned value:
instance.test.sendTranaction({gass:4200000});
I'm wondering how I can get the return value in geth console.