Dear experts
I am using LiveCode's browser support, to display Maths. I make calls to JavaScript functions and some of these functions take arguments. One of the JavaScript functions must append string data to its arguments, but fails to do so for no appearent reason. The concatenation only fails when the function is called from my LiveCode app. It works without a problem if the function is called from outside of my LiveCode app.
The LC documentation says that LC internally treats the arguments as null terminated strings. Could that be the cause of the problem? How can it be fixed? It should be noted that my dev environment is Microsoft Windows 8.
Thanks in advance
Cairoo
Edit: I've created and attached a sample project to demonstrate the problem. Please have a look.
[Solved] String concatenation in JS function called from LC
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
[Solved] String concatenation in JS function called from LC
- Attachments
-
- js-concat-problem.zip
- (1.56 KiB) Downloaded 312 times
Last edited by Cairoo on Fri Apr 05, 2013 10:46 am, edited 1 time in total.
Re: String concatenation in JS function called from LC
Never mind; I found the solution.
All I had to do was to write a JavaScript function that removes the null terminator from the argument. It works now.
Here's the JavaScript code for removing the null terminator from a string:
Thanks for reading.
All I had to do was to write a JavaScript function that removes the null terminator from the argument. It works now.
Here's the JavaScript code for removing the null terminator from a string:
Code: Select all
function removeNullTerminator(theNullTerminatedString) {
var theArray = theNullTerminatedString.split('');
theArray.splice(theArray.length - 1, 1);
var newString = theArray.join('');
return newString;
}