[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: undefined conversion for numeric indexes
- From: David Jones <djones@...>
- Date: Mon, 17 Jun 2002 09:19:00 +0000
In message <42479.1024065042@zoonami.com>, David Jones writes:
> In my lua 4.0 the following code crashes (with a floating point
> exception):
>
> a={}
> a[2^31+1]=1
Further investigation reveals that getn uses a similar conversion and
can crash in the same way.
(While I was looking at getn I noticed)
There is a bug in the documentation for getn. The documentation says:
... the largest numerical index with a non-nil value in the table
but the following code prints 0:
print(getn{[-9]="foo"})
So the documentation should say:
This number is the value of the table field n, if it has a numeric
value, or the largest positive numerical index with a non-nil value
in the table, or 0 if no such index exists.
Cheers,
drj