[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Acceptable indicies
- From: liam mail <liam.list@...>
- Date: Tue, 30 Aug 2011 16:37:06 +0100
On 30 August 2011 16:22, oliver <email@example.com> wrote:
> I was under the impression that the stack has a certain size (say, 20,
> defined when the lua lib is compiled),
The stack has a default size which if unchanged is 20,
> and that gettop just returns the
> index of the top-most element on that stack.
> So if top=10, an index is still
> acceptable if it refers to 11, but not if it refers to 21.
It depends on if you have requested the stack to grow and if you have
changed the default, with the default 11 would be an acceptable yet
> Is this defined
> rigorously anywhere?
Acceptable index 
(index < 0 && abs(index) <= top) ||
(index > 0 && index <= stackspace)
Valid index 
We say that an index is valid if it lies between 1 and the stack top
(that is, if 1 ≤ abs(index) ≤ top).