基本 AutoLisp 变量、函数直通

Basic AutoLisp Variable, Function Passthrough

好的,我似乎无法将一个简单变量传递给函数中的另一个变量。我不明白我在这里做错了什么。为什么传递一个字符串转换为 nil 的变量,但传递原始字符串保持不变?

;; Main Procedure
(defun C:Debug01(/ dirPath sResult)

    ;; Pulls and shows directory of current file
    (setq dirPath (getvar 'dwgprefix))
    (princ (strcat "\n \n" dirPath "\n \n"))

    ;; Basic Function
    (setq sResult (fcnBasic "Message 1" dirfile "Message 3" "Title"))
    (princ (strcat " \nResulting output : " sResult "\n "))
    (princ)
)

;; A Basic Function
(defun fcnBasic (message1 message2 message3 main / sReturn)

    ;; Displaying values
    (princ (type message1)) (princ (strcat " : " message1 "\n"))
    (princ (type message2)) (princ (strcat " : " message2 "\n")) ;; Message 2 should equal "C:\Users\Garrettb\Documents" with a type of STR.
    (princ (type message3)) (princ (strcat " : " message3 "\n"))
    (princ (type main))     (princ (strcat " : " main "\n"))

    ;; Returning a value
    (setq sReturn message2)
    (return sReturn)
)

行内:

(setq sResult (fcnBasic "Message 1" dirfile "Message 3" "Title"))

您传递了未在函数 C:Debug01 中初始化的变量 dirfile。 Maye 某处是,我不知道。 您设置的变量值 dirPathdirfile 不同 ;)