lua-users home
lua-l archive

Re: table.insert and negative numbers

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


Matthew Paul Del Buono wrote:
> Thus, table.insert has a problem as it uses lua_rawgeti,
> but accessing a table directly does not.
Right; I generalized incorrectly. It's table.insert(t,n,v), not t[n]=v,
that has the problem.
Perhaps the three-parameter form table.insert(t,n,v) should restrict n
to be an integer in [1, #t + 1]. If it is not and integer or not in that
range then a normal lua_settable() would be used (or something else
would happen - error?). The code in tinsert() is simple enough to be
modified in a number of useful ways.
Doug
-- 
Innovative Concepts, Inc. www.innocon.com 703-893-2007 x220

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