lua-users home
lua-l archive

table constructors

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


I'm trying to construct a 2d associative array like this
temp = {"a", "b"}
temp["a"] = {"a" = 0, "b" = 2}
temp["b"] = {"a" = 1, "b" = 0}
What's wrong with the syntax? I'm trying to achieve this..
temp = {"a", "b"}
temp["a"] = {}
temp["a"]["a"] = 0
temp["a"]["b"] = 2
temp["b"] = {}
temp["b"]["a"] = 1
temp["b"]["b"] = 0
thanks

AltStyle によって変換されたページ (->オリジナル) /