Home » U++ Library support » U++ Core » do upp have an equivalent of "eval()" in Javascript
|
|
Re: do upp have an equivalent of "eval()" in Javascript [message #31367 is a reply to message #31360] |
Fri, 25 February 2011 12:47 |
|
ratah wrote on Fri, 25 February 2011 10:39 | Hi everybody,
I want to execute some String without writting code.
In Javascript, i can do this.
http://www.w3schools.com/jsref/jsref_eval.asp
I want to know if an equivalent function exists in upp.
Thannk you
|
I see two simple ways to do this, but as Mirek said, it depends a lot on the string content.
First option is Esc, U++ native scripting language. It is similar to C, with few interesting distinctions (see help for details).
Second option is compiling C code in the string on the fly, using TCC (turbo C compiler). There is a package with examples in bazaar.
Both methods allow for binding native C++ functions into the executed code/script.
You could also use 3rd party bindings for Lua, Python, etc... but since you asked for native U++ solution, I guess that is not what you want
Best regards,
Honza
|
|
|
Goto Forum:
Current Time: Thu Apr 18 13:46:55 CEST 2024
Total time taken to generate the page: 0.02630 seconds
|