lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Thursday, July 4, 2013, Jay Carlson wrote:


I'd be willing to contemplate a uniform void value, but only if it were true-ish. We already went through nil->false, and I'm bored. I want new, interesting bugs rather than boring old NullPointerExceptions.

Jay

Jay, a question, although only out of curiosity (I've returned to "Lua is fine" mode):

Would some kind of mechanism to discover the existence of a variable suffice? That is, the mechanism returns a boolean, not a void / etc.

I assume that if it would not, it would be because, as I learned after doing some `collectgarbage("count")` checking, Lua really really does not actually put nil into a table. So without "void" or "nil(undefined)" the OP's use case, at least, wouldn't be covered. 

I thought Lua did keep nils in tables around internally, and just didn't provide a way to determine the difference between "not there" and "not there, as far as you know," As it does with local variables. 

- Andrew