[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]
Part1 - Part2 - Single Page
Top Document: comp.cad.autocad AutoLISP FAQ (part 1/2) - general
Previous Document: [12] How to Autoload my programs?
Next Document: [14] How can I avoid stack overflows?
-
Search the FAQ Archives
Part1 - Part2 - Single Page
Top Document: comp.cad.autocad AutoLISP FAQ (part 1/2) - general
Previous Document: [12] How to Autoload my programs?
Next Document: [14] How can I avoid stack overflows?
[13] How can I pass a variable number of arguments to a lisp
With plain AutoLISP this is not possible.
You can either pass all your arguments in a list like this:
;;; print a variable number of arguments (of any type)
(defun my-princ (x)
;; simple version, for better stuff look at the SDK2: PRINTF.LLB
(if (listp x)
(mapcar 'princ x)
(princ x)))
Or you have to define the function in ADS and export it to
AutoLISP.
Then you are free to write:
(ads-print "Hello " "World " 1 2 3)
or even
(ads-printf "Hello %s %i %i" "World" 2 3)
Look at Reini Urban's and Vladimir Nesterovsky's ADS samples at
http://xarch.tu-graz.ac.at/autocad/ads for implementations of the
above examples.
Official wishes were pointed to Autodesk regarding &optional as
AutoLISP language enhancement, but it was not implemented in R14.
Top Document: comp.cad.autocad AutoLISP FAQ (part 1/2) - general
Previous Document: [12] How to Autoload my programs?
Next Document: [14] How can I avoid stack overflows?
Part1 - Part2 - Single Page
[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]
Send corrections/additions to the FAQ Maintainer:
rurban@xarch.tu-graz.ac.at (Reini Urban)
Last Update July 25 2008 @ 00:10 AM