lua-users home
lua-l archive

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

Hey folks

I've been thinking about the usage of lua_checkstack()/luaL_checkstack() and I have some questions:

1) What do people think is the best practice for using these calls? Be safe and call them every time you push something onto the stack from C? Follow the (afaict) convention in Lua itself and only checkstack if you're going to push more than 5 objects?

2) Given that the stack has a maximum size, how come Lua doesn't grow the stack automatically when it gets full?

3) Just to be sure that I'm understanding the docs correctly, when pushing a table, no matter how big it is, I only need two stack slots - one for lua_newtable() and one that's used for each value before lua_setfield() pops it off the stack. Right?

4) What other interesting/useful things can you tell me about stack management from C? :)