Sponsored links

【AutoLISP FIRST STEP】 What is an Argument?

Sponsored links
AutoLISP
Sponsored links

Argument is information that a function needs to do its work.

Sponsored links

What is an Argument ?

With AutoLISP, many functions require you to pass them values. These values are known as arguments.

Autodesk Help page

For Example

There is a function + whose task is adding numbers.
However, if you didn’t give the numbers beside the function, AutoCAD cannot do anything.

Jagaimo
Jagaimo

(+)

Add numbers!

I cannot do add if you don’t give me the numbers.

Therefore, when you use the function + you have to give more than 2 numbers as augments.

Jagaimo
Jagaimo

(+ 1 2)

Add 1 and 2

3

Here another example, function alert whose task is display a dialog box with a message.
Same here, if you don’t give the message to show, AutoCAD will never know what it should display.

 (alert “Hello World”)

In this case, a string “Hello World” is the argument.

Depending on functions, the required arguments are different.
So, when you see a new function, you should check Autodesk’s help page for the required arguments. It is important for the AutoLISP Program to work property.

To Sum Up

  • An argument is a required value for a function.
  • Depending on functions, required arguments are different.

Comments