> 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