Its okey or not?

"blogdron (BLOGDRON)" <[email protected]>
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
Test 1 OK
type(((''):byte())) 

Test 2 ERR bad argument #1 to 'type' (value expected)
type((''):byte()) 

Test 3 OK
string.byte = function (s) return nil  end
type((''):byte())

Test 4 ERR bad argument #1 to 'type' (value expected)
string.byte = function (s) return  end
type((''):byte())

"function x() return end" not equal "function x() return nil end"? 
This case is for all Lua versions.  

This behavior is probably well-known, but I've never encountered it before. I 
thought if a type received a nil, it would simply return a nil, but 
sometimes there's literally nothing there, not a nil. Now I'm paranoid 
about wrapping everything in parentheses, even if the function returns only 
one value :D  haha and/or if function return nothing im force wrote return 
nil

I thought I'd share. It seems I still don't know Lua ::)

-- 
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/ff009071-c489-4e98-9bc6-4046fcce63dbn%40googlegroups.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.