Author Topic: ABC's of AutoLisp--Protected Symbol error  (Read 2477 times)

0 Members and 1 Guest are viewing this topic.

Jeff H

  • Needs a day job
  • Posts: 6150
ABC's of AutoLisp--Protected Symbol error
« on: April 14, 2011, 03:40:23 AM »
Usually when I would look at Lisp it would make me make a face like when you smell a bad fart.

But after reading a litte more than half of this http://klobouk.fsv.cvut.cz/~chour/Lisp/Contents.htm
it seems like it would be fun to play with

and I am sure you all have read it
but it is a great primer as I can start to understand some of the code that is being posted.

Anyways I decided to try some of the code and my first expirence with AutoLisp I keep getting a message box with AutoCAD 2012-32bit
"Assignment to Protected Symbol
Last:
Enter breack loop"



What would be protected?

Code: [Select]
(defun C:SEQ (/ pt1 currnt last)
  (setq pt1 (getpoint "\nPick start point: "))
  (setq spc (getdist pt1 "\nEnter number spacing: "))
  (setq currnt (getint "\nEnter first number: "))
  (setq last (getint "\nEnter last number: "))
  (setq stspc (rtos spc 2 2))
  (setq stspc (strcat "@" stspc "<0"))
  (command "text" pt1 "" "" currnt)
  (repeat (- last currnt)
    (setq currnt (1+ currnt))
    (command "text" stspc "" "" currnt)
  )
)

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: ABC's of AutoLisp--Protected Symbol error
« Reply #1 on: April 14, 2011, 03:56:36 AM »
Hi,

'last' is a native LISP function (which returns the last item in a list).

As the 'last' variable is localized, it's only redefined within the routine.

Using the VLIDE should help you with the color syntax (last should display in blue).
Speaking English as a French Frog

Jeff H

  • Needs a day job
  • Posts: 6150
Re: ABC's of AutoLisp--Protected Symbol error
« Reply #2 on: April 14, 2011, 04:02:57 AM »
Hi,

'last' is a native LISP function (which returns the last item in a list).

As the 'last' variable is localized, it's only redefined within the routine.

Using the VLIDE should help you with the color syntax (last should display in blue).
Thank you gile,

That was it.
I was reading the error as enter last break loop
It was right there in my face.