Dynamic functions

Started by statik, June 17, 2005, 08:15:37 AM

Previous topic - Next topic

statik

(set 'a "myprogram -abc -use=something example.txt")

(set 'b (parse a))



b => ("myprogram" "-abc" "-use=something" "example.txt")



Now I need a way to execute this as a newlisp function. Something along the lines of:



(eval ((nth 0 b) (nth 1 b) (nth 2 b) (nth 3 b)))



I need newlips to try to turn all that into (myprogram -abc -use=something example.txt), or in other words, I need it to take my string and turn it into a newlisp function.



Any ideas?
-statik

statik

#1
Ok, I got it running the function using:



(eval-string (append "(" (nth 0 parsed) " " (nth 1 parsed) ")"))



However, the (nth 1 parsed) needs to be a string.



I cant add quotes though using append: eg, (append """ (nth 1 parsed) "'")



Any help is appreciated.
-statik

statik

#2
grundle got me some working code :) kudos.
-statik