Page 1 of 1

Can livecode run code presented in a text field.

Posted: Wed Aug 07, 2013 1:17 pm
by user#606
Assuming the text in a textbox was perfectly correct code, identical to the way it is presented in the editor, is there any way to run it?

An example of that process might be an exe built in LC that generates correct code in a field to run as part of the exe. The code would be generated as a result of different inputs to questions or outcomes.

Re: Can livecode run code presented in a text field.

Posted: Wed Aug 07, 2013 3:40 pm
by Martin Koob
Use the 'do' command

do field "Statements"

There is a limit of the number of lines you can run in this way. I think it is 10.

Martin

Re: Can livecode run code presented in a text field.

Posted: Wed Aug 07, 2013 3:51 pm
by Martin Koob
I just looked up scriptlimits in the dictionary to see what the limits are.
When using a standalone application, an object's script property may not be set to a string containing more than ten statements. This limit is set by line 1 of the scriptLimits function. (This does not limit scripts that are already written: standalone applications can run scripts of any length.
So it looks like you may not be limited if the scripts were typed in a field.

Re: Can livecode run code presented in a text field.

Posted: Thu Aug 08, 2013 4:15 pm
by andrewferguson
While you may be limited to 10 lines of code in the commercial edition of LiveCode, there is no limit in the Community Edition.
If you are using the Commercial Edition, then contact RunRev, as they sometimes allow applications with the "do" command, but on a case by case basis.

Andrew

Re: Can livecode run code presented in a text field.

Posted: Thu Aug 08, 2013 9:25 pm
by jacque
I believe the limitation is in the engine, and the scriptlimits aren't checked until the engine tries to compile the code. That means the 10-line limit will be enforced with the "do" command as well as when setting an actual script. But as Andrew said, it doesn't apply to the community version.

Re: Can livecode run code presented in a text field.

Posted: Sat Aug 10, 2013 10:48 am
by andrewferguson
Hi,
There is also the "debugDo" command, but I never understood what it did.
Anyone out there know how it works?
Andrew