example:
print(myJoints[#myJoints].length);
prints:
hello world0.80000019073486
something I miss? [import]uid: 3686 topic_id: 1333 reply_id: 301333[/import]
example:
print(myJoints[#myJoints].length);
prints:
hello world0.80000019073486
something I miss? [import]uid: 3686 topic_id: 1333 reply_id: 301333[/import]
logged as bug 285 [import]uid: 3 topic_id: 1333 reply_id: 3614[/import]
That’s an awesome bug! I have just removed the “hello world” line in the source code.
If you literally want the length of a table named myJoints, the correct notation is:
print( #myJoints )
What you’re doing in your example (as you probably know) is getting the PHYSICAL length of a joint that happens to be stored in a table entry. Lua doesn’t use “length” to mean an array length.
Relatedly, I see a bug in the source: it’s reporting distance joint length in meters rather than pixels, which is why you’re getting a strange value like 0.8. This will also be fixed. [import]uid: 3007 topic_id: 1333 reply_id: 3615[/import]
Thanks for the fast response. Yes, that’s exactly what I want to accomplish with the code. The title of the bug report wasn’t correct, my bad. And yes it was awesome to find it out
Thanks again. [import]uid: 3686 topic_id: 1333 reply_id: 3621[/import]