Incorrect description of evalCommandGetLabels in javascript reference

jlaurens shared this problem 2 years ago


Actually, the documentation at reads

String[] evalCommandGetLabels(String cmdString)5.0Like evalCommands, but the return value is an array with labels of created objects.

That is not correct, the return value is not an array of strings.

If you run for example

  1. var Ls=ggbApplet.evalCommandGetLabels("(0,0)\n(1,1)");

then Ls is a NativeJavaObject, which looks very close to a string containing a comma separated list of labels.

If you want an array of string, then you have to use instead

  1. var Ls=ggbApplet.evalCommandGetLabels("(0,0)\n(1,1)").split(",");

In case of error, the return value is a null object.

Letting ggbApplet.evalCommandGetLabels return an array of strings as advertised instead of just one string would possibly break existing code. Then updating the documentation to describe the correct behaviour would be more efficient.

I can do that for both english and french documentations if necessary.

Comments (3)


C'était juste pour avoir une traduction plus fidèle de la page anglaise.


Thanks, how's that now?


The function signature should be updated as well: remove the "[]".

Maybe we can append to the description: Returns null when command evaluation failed.


© 2020 International GeoGebra Institute