state_getval function

Get the state value kept in last call.