lua-users home
lua-l archive

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


On Tue, 22 Sep 2020 at 08:11, 孙世龙 sunshilong <sunshilong369@gmail.com> wrote:


> How to comprehend that Lua automatically removes whatever is in the
> stack below the results after the function returned?
> How does it achieve this goal?
> Any explanation or document helps.
> I would be grateful if you could shed some light on this matter.
>

Lua's stack is a heap allocated structure. There is a pointer to the
top of the stack in each Lua State - this is simply reset after a
function call. Stack can also be reallocated to reduce or grow as
needed.

Regards