function JS() bug ?

23 views
Skip to first unread message

duccio

unread,
Oct 31, 2015, 1:50:38 PM10/31/15
to RapydScript
Hi,
if i translate this pyj code:

JS("my.log(textStatus+'\n'+errorThrown+'\n'+jqXHR.responseText);")

i get this js:

my.log(textStatus+'
'+errorThrown+'
'+jqXHR.responseText);;

it seems like the string '\n' becomes a new line
(the 2nd ; at the end is ok?)

Thanks!


I use rapydscript 0.3.9
with node 0.12.4 on win xp

Alexander Tsepkov

unread,
Nov 1, 2015, 11:03:09 PM11/1/15
to duccio, RapydScript
RS interprets \n inside the string as a newline character during compilation, this is no different from regular string. It does no processing to determine if you're nesting other strings within a string. This is no different from how eval() works. It sounds like what you actually want is \\n instead of \n.

duccio

unread,
Nov 2, 2015, 8:47:56 AM11/2/15
to RapydScript
ops... sorry,
I discover now that also python exec works like this...

Thanks!
Reply all
Reply to author
Forward
0 new messages