Page 1 of 1
how can run a LC script code in my standalone APP
Posted: Wed Nov 14, 2018 5:00 pm
by longzexd
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!
Re: how can run a LC script code in my standalone APP
Posted: Wed Nov 14, 2018 5:13 pm
by SparkOut
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
Re: how can run a LC script code in my standalone APP
Posted: Wed Nov 14, 2018 7:31 pm
by jmburnod
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
Re: how can run a LC script code in my standalone APP
Posted: Thu Nov 15, 2018 3:53 am
by longzexd
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
Re: how can run a LC script code in my standalone APP
Posted: Thu Nov 15, 2018 3:56 am
by longzexd
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
Re: how can run a LC script code in my standalone APP
Posted: Sun Nov 18, 2018 10:19 pm
by ClintMA
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.
Re: how can run a LC script code in my standalone APP
Posted: Sun Nov 18, 2018 10:23 pm
by bogs
Erm, isn't what your describing what the code editor already does? Or am I missing something (again)

Re: how can run a LC script code in my standalone APP
Posted: Sun Nov 18, 2018 11:44 pm
by jmburnod
@ longzexd
Just for my curiosity, why do you want use a standalone instead a simple stack ?