lua-users home
lua-l archive

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


Hey

Thanks :)

Chris

On 6 April 2018 at 13:48, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> One other question occurred to me - what about situations where C is doing something in a situation where it hasn’t been called from Lua? Eg a C callback is triggered and calls a Lua function?
> I’m thinking in that situation it probably has no guarantee about stack slots and should grow the stack for everything?

When Lua starts, it ensures those 20 slots. So, if each of these
"situations" always use the stack balancedly (e.g., a callback pops
everything it pushed), you don't need to check the stack. (If they use
the stack unbalancedly, you are doomed to have a stack overflow sooner
or later.)

-- Roberto




--
Cheers,

Chris