lua-users home
lua-l archive

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


On 28/06/13 18:24, Roberto Ierusalimschy wrote:
Maybe I am missing something obvious, but Lua already has an "empty" value. It is called "false".

Now maybe I am missing something obvious :)
But empty is not a noun, is an adjective. Something can be empty. To be capable of being empty, it must be capable of holding something in the first place. Thus a table. This leads to

empty = function(t) return next(t)==nil end

If I want store emptiness, I should wrap all my stuff in tables

t[x] = nil --nothing
t[y] = {'stuff'} --something not emptiness
t[z] = {} --something: emptiness

I consider this argumentation completely irrefutable. Hope nobody restarts it using the term "void" :-\

Jorge