[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Is there a C API that could exchange the values at different index of the stack?
- From: Francisco Olarte <folarte@...>
- Date: Fri, 22 Jan 2021 10:08:29 +0100
Suota:
On Fri, Jan 22, 2021 at 10:03 AM Suote127 <tswuyin_st127@163.com> wrote:
> In my opinion,the easiest situation is that two indexes have the same sign(both positive or both negative)
> And it is just for checking that the two values are at different indexes,is not it?
No, check my precious message.
Apart from simplifying the NO-OP check it is because negative indexes
to a slot change with stack size, and I'm doing pushvalue/replace==pop
and copy.
In a chunk of inline, where you have control on what you are doing, I
may skip them. On something dessigned to be used as a building block,
like the funcs in luaL, I need to assume i and j may bne negatives or
seudo-indexes ( like LUA_REGISTRY_INDEX, although I doubt I can swap
from those ).
FOS