[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: table.insert and negative numbers
- From: Doug Rogers <rogers@...>
- Date: Thu, 10 Apr 2008 15:13:24 -0400
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.
Innovative Concepts, Inc. www.innocon.com 703-893-2007 x220