lua-users home
lua-l archive

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


On Wed, Mar 12, 2008 at 9:06 AM, Alexandr Leykin <leykina@gmail.com> wrote:
>  a = {a,b,c,d}

This is equivalent to:
a = {[1] = a, [2] = b, [3] = c, [4] = d}

>
>  a.a => nil, but key "a" present in table!
>  a.f => nil, but key "f" not in table!

You probably want:

a = {["a"] = true, ["b"] = true, ["c"] = true, ["d"] = true}

Then,
a.a => true (present in table)
a.f => nil (not present in table)

-- 
-Patrick Donnelly

"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."

-Will Durant