Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A null pointer is a boxed value in LuaJIT, therefore not nil. But it is equal to nil when compared with nil.

    local x = require('ffi').cast('void*', nil)
    if x and x == nil then
        print("x is truthy and nil at the same time")
    end


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: