str(xxx) and xxx.toString()

34 views
Skip to first unread message

Bruce Sherwood

unread,
Sep 19, 2015, 9:54:52 PM9/19/15
to RapydScript
GlowScript has an important class, "vec", where vec(1,2,3) is a geometric vector with components 1, 2, and 3. 

vec.prototype.toString is a function that returns the string "< 1, 2, 3 >", a standard vector notation found in some calculus textbooks and in our Matter & Interactions intro physics textbook.

But if I write str(vec(1,2,3) in RapydScript, what returns is the unexpected character string {"x":1, "y":2, "z":3}.

Shouldn't str(xxx) in RapydScript be the same as xxx.toString()? Note that str(xxx) is undefined in JavaScript.

Bruce

Reply all
Reply to author
Forward
0 new messages