OK, now that my eyeballs are all dried up and smoke is billowing from my ears...lets see if I can't get this ChupaCabras by the tail!
*on load, you've set getvalue to level 2
*then reset getvalue to level 1
*x returns level 1
*y re-runs getvalue and sets it to level 2
*z since getvalue has been left global it returns level 2
*second instance of "doit"
*x, y, and z since getThisValue=getvalue that has been left global all variables return level 2 using the getvalue routine that is in memory
..but suppose I did this:
(defun getThisValue (/ a)
(defun getValue ()
(princ "Level 2")
(setq a 1.0)
)
(getValue)
;;;)
(defun getValue (/ a)
(princ "Level 1")
(setq a 2.0)
)
(defun doIt (/ x y z)
(setq x (getValue))
(terpri)
(setq y (getThisValue))
(terpri)
(setq z (getValue))
(princ)
)
) ;<===== moved
Now what have I got? Why do I get:
_$ (doit)
Level 1
Level 2
Level 1
_$ (doit)
Level 1
Level 2
Level 1
Isn't getvalue= level 2...and should stay there?