how can run a LC script code in my standalone APP

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
longzexd
Posts: 7
Joined: Sun Oct 28, 2018 9:41 am

how can run a LC script code in my standalone APP

Post by longzexd » Wed Nov 14, 2018 5:00 pm

Hello everyone:
Just for education purpose, I want to develop an APP which can run a piece of LC script code and output the results, such as in the main window, the user types some LC code and press one button labeled with "Running ", then output the results. Thanks!

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: how can run a LC script code in my standalone APP

Post by SparkOut » Wed Nov 14, 2018 5:13 pm

Code: Select all

put field "codeSnippet" into codeSnippet 
-- SANITISE THE CODE SNIPPET
-- check for bad code, whether accidental or deliberate
-- then once you have code that is safe to run,
do tCodeSnippet

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: how can run a LC script code in my standalone APP

Post by jmburnod » Wed Nov 14, 2018 7:31 pm

Hi longzexd,
The idea is attractive but you have to consider you will lost edit tools (indentation for loop, search tools ...)
Just a thought
Best regards
Jean-Marc
https://alternatic.ch

longzexd
Posts: 7
Joined: Sun Oct 28, 2018 9:41 am

Re: how can run a LC script code in my standalone APP

Post by longzexd » Thu Nov 15, 2018 3:53 am

Thanks a lot !
SparkOut wrote:
Wed Nov 14, 2018 5:13 pm

Code: Select all

put field "codeSnippet" into codeSnippet 
-- SANITISE THE CODE SNIPPET
-- check for bad code, whether accidental or deliberate
-- then once you have code that is safe to run,
do tCodeSnippet

longzexd
Posts: 7
Joined: Sun Oct 28, 2018 9:41 am

Re: how can run a LC script code in my standalone APP

Post by longzexd » Thu Nov 15, 2018 3:56 am

yes, it will lost some edit tools functions, however I just want the user to master some basic LC script grammar. Thanks!
jmburnod wrote:
Wed Nov 14, 2018 7:31 pm
Hi longzexd,
The idea is attractive but you have to consider you will lost edit tools (indentation for loop, search tools ...)
Just a thought
Best regards
Jean-Marc

ClintMA
Posts: 39
Joined: Thu Jan 21, 2016 2:52 am

Re: how can run a LC script code in my standalone APP

Post by ClintMA » Sun Nov 18, 2018 10:19 pm

It seems to that some basic automatic indentation would be important for new students getting used to Livecode. And, with the naviety of someone who hasn't actually tried it, it seems that it shouldn't be that hard to implement.

E.g. watch for some basic keywords like on, function, if, repeat, etc., and on the return key being pressed, add an additional amount of indentation to the current indentaion until the keyword "end" is encountered.

It might even be possible to code for automaically adding the "end" line below the "on" line, but, in this case, one would have to use a different way to determine if a line should be indented, perhaps using flags.

It may also be that someone in this group has already written similar code. It might be worth searching around a bit for it.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: how can run a LC script code in my standalone APP

Post by bogs » Sun Nov 18, 2018 10:23 pm

Erm, isn't what your describing what the code editor already does? Or am I missing something (again) :?
Image

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: how can run a LC script code in my standalone APP

Post by jmburnod » Sun Nov 18, 2018 11:44 pm

@ longzexd
Just for my curiosity, why do you want use a standalone instead a simple stack ?
https://alternatic.ch

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”