Old 06-08-2019, 04:56 AM   #1
mpl
Human being with feelings
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,422
Default Lua Assert/Load analog in EEL2 (JSFX)?

Is there a way to execute string as code, like this?

Code:
string = strcpy(#,'function(x) return x*2 end');
new_function = assert(string);
out_val = new_function(2);
> 4
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate
mpl is offline   Reply With Quote
Old 06-08-2019, 12:33 PM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,672
Default

Quote:
Originally Posted by mpl View Post
Is there a way to execute string as code, like this?
Eel ReaScript has :

Code:
EEL: eval("code")

Executes code passed in. Code can use functions, but functions created in code can't be used elsewhere.
But I don't think that's available for JSFX.
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is offline   Reply With Quote
Old 06-09-2019, 07:22 AM   #3
mpl
Human being with feelings
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,422
Default

Thanks.
It seems it doesn`t works even in EEL. I could missed something though.

Code:
sr = eval('function getval()
     (
       2+3; // return 5
     );');
> too long multibyte character

Code:
function getval()
     (
       2+3; // return 5
     );

test = getval()
> 5
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate

Last edited by mpl; 06-09-2019 at 07:28 AM.
mpl is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:33 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.