lua-users home
lua-l archive

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


>> >Assuming table is at index 1
>> Index 1?
>> In general, the index of the stack is a negative number, e.g -1, -2, and so on.

>Not in the common case of referring to arguments passed to your C function from Lua, which are usually referred to with positive numbers
> (since the first >argument is always at index 1, the second argument at index 2, etc.)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Could you please explain that(i.e the emphasised part) in more detail?


On Fri, Jan 15, 2021 at 9:15 AM Jonathan Goble <jcgoble3@gmail.com> wrote:
>
> On Thu, Jan 14, 2021 at 8:10 PM 孙世龙 sunshilong <sunshilong369@gmail.com> wrote:
>>
>> >Assuming table is at index 1
>> Index 1?
>> In general, the index of the stack is a negative number, e.g -1, -2, and so on.
>
>
> Not in the common case of referring to arguments passed to your C function from Lua, which are usually referred to with positive numbers (since the first argument is always at index 1, the second argument at index 2, etc.)