I am trying to get an array value from network tables in java but can’t seem to get it right.
currently using this…
double] width = Table.getNumberArray("width");
but I am getting this
The method getNumberArray(String) from the type NetworkTable is deprecated
how would I fix this?
Deprecated methods means that they are old or may no longer be supported/may be removed in a future update.
However, they should still work. I assume you aren’t getting an error, but rather a warning.
As for fixing it: You’d have to use the new way of doing what you are trying to do. I don’t know what it is called off the top of my head.
This new method allows you to set a default value as a second parameter to return if no value can be found. The new method is getNumberArray(String key, Double] defaultValue).
after using
double] defaultval = new double[0];
getNumberArray("width", defaultval );
it says defaultval is a double but it needs to be a double]
forgive me if im missing something very obvious switched over to java 4 days ago and arrays are not my strong suit
Try this:
Double] x = {0.0};
getNumberArray(“width”, x);