Nmap NSE 脚本函数的行为与变量或硬编码字符串作为参数时不同

我正在尝试编写一个 Nmap NSE DNS 暴力破解脚本来完成学校的作业。 我的问题是,当使用函数:dns.query(dname,options),其中dname是一个FQDN时,如果参数为:

1:像这样硬编码字符串

local status,result = dns.query("www.domain.com",{dtype ="A",retAll = true})

或2:在函数匹配中制作的变量将两个字符串连接在一起

local status,result = dns.query(domain,{dtype ="A",retAll = true})
local function match(sub,host)
        local domain = print(sub .. "." .. host.name)
        local status,result = dns.query(domain,{dtype ="A",retAll = true})
        if status =="true" then
                return domain
        end
        return''
end

调试模式显示变量domain确实等于硬编码字符串的值。但是行为不同。

这种问题可能是由什么原因引起的?

dns库的文档:https://nmap.org/nsedoc/lib/dns.html

点赞