nil 才是关键字,比如:
local myHero = Heroes.GetLocal()
if myHero == nil then ... end -- correct
if not myHero then ... end -- correct
if myHero == nill then ... end -- wrong
`
有意思的是,对于未声明的变量:
wtf == 1 -- false
wtf == nil -- true
wtf == nill -- true
wtf == nillonglongstring -- true
wtf == anotherWtf -- true
nil 才是关键字,比如:
local myHero = Heroes.GetLocal()if myHero == nil then ... end -- correctif not myHero then ... end -- correctif myHero == nill then ... end -- wrong`
有意思的是,对于未声明的变量:
wtf == 1 -- falsewtf == nil -- truewtf == nill -- truewtf == nillonglongstring -- truewtf == anotherWtf -- true