I have been experimenting with generating variables through code rather than defining them manually. The problem is that when the program creates them, they are defined as global variables. Is there a way to generate them as local variables instead?
Below is the sample code that I wrote for testing it.
;ListToVariables creates variables named testvar0, testvar1, testvar2, etc.
;Each newly created variable contains the contents of the correlated slot from testlist.
(defun c:test ( / testlist )
(setq testlist (list "aaa" "bbb" "ccc" "ddd" "eee"))
(ListToVariables testlist)
)
(defun ListToVariables ( listname / i )
(setq i 0)
(repeat (length listname)
(set (read (strcat "testvar" (rtos i 2 0))) (nth i listname))
(setq i (1+ i))
)
(princ)
)