Strange error tooldatanot type name

After adding a persistant variable for tooldata in RobotStudio 5.13.10, I get a strange message:

/IRB6400R_200kg_2.5m/RAPID/T_ROB1/VisSearch(9,3): Error 82 : Reference error : tooldatanot type name

Clearly, tooldata IS a type name, but I’m not sure what I’m doing wrong here.
Has anybody seen this message before?

Here is the line where I added the tooldata:

PERS tooldata toolVisSensor:=[TRUE,[[2.52159,158.11,336.934],[1,0,0,0]],[10,[0,100,300],[1,0,0,0],0,0,0]];

TIA to anyone who can shed some light…

Try changing the name of the tool to something that hasn’t got the word “tool” in it. I think “tool” may be a keyword. I seem to recall similar issues in the past, but it was a while ago. Worth a try anyway.

That seems reasonable, but I noticed a couple of things:

D’oh!

When I looked for things named …tool… I found my error.
I made a function and transposed the function name and the returned datatype.

This apparently polluted the keyword “tooldata”, so that Robotstudio thinks it’s no longer a datatype name–because ALL the tooldata declarations became bogus (it only tells you about the first one).

so, changing
FUNC RelToolData tooldata …
to
FUNC tooldata RelToolData …

fixes it.

Thanks!!

(although, I must comment that the error message was sort of misleading!)