Can livecode run code presented in a text field.

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
user#606
Posts: 217
Joined: Sun Jan 27, 2008 12:25 pm
Location: Alderney, Channel Islands
Contact:

Can livecode run code presented in a text field.

Post by user#606 » Wed Aug 07, 2013 1:17 pm

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.

Martin Koob
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 237
Joined: Sun May 27, 2007 8:19 pm

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

Post by Martin Koob » Wed Aug 07, 2013 3:40 pm

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

Martin Koob
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 237
Joined: Sun May 27, 2007 8:19 pm

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

Post by Martin Koob » Wed Aug 07, 2013 3:51 pm

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.

andrewferguson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 183
Joined: Wed Apr 10, 2013 5:09 pm

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

Post by andrewferguson » Thu Aug 08, 2013 4:15 pm

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5088
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

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

Post by jacque » Thu Aug 08, 2013 9:25 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

andrewferguson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 183
Joined: Wed Apr 10, 2013 5:09 pm

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

Post by andrewferguson » Sat Aug 10, 2013 10:48 am

Hi,
There is also the "debugDo" command, but I never understood what it did.
Anyone out there know how it works?
Andrew

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”