lua-users home
lua-l archive

Re: table "ordinal" indexes

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


> t = {[1]=1, 2}
> return t[1]
> 2
> What is the correct interpretation?
luac -l -p can help clear in these cases
 1 [1] NEWTABLE 0 1 1
 2 [1] SETTABLE 0 -2 -2 ; 1 1
 3 [1] LOADK 1 -3 ; 2
 4 [1] SETLIST 0 1 1 ; 1
 5 [1] SETGLOBAL 0 -1 ; t
 6 [1] RETURN 0 1
Note that SETTABLE sets t[1]=1 and then SETLIST sets t[1]=2.

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