lua-users home
lua-l archive

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


I recently activated the runtime checks/tests and found that one of my bugs
was likely due to a stack overflow.  I soon realized that there were some
operations I was performing that left values on the stack.  For example,
loading libraries with lua_xxxlibopen(), etc. may push values onto the
stack, according to lua_gettop() anyway.  In fact, by the time I got to do
any "real" work, the stack had 13 items on it.

In the examples and docs, I don't see mention of cleaning up the stack after
operations like these.  Is it good practice to simply do a lua_settop(l, 0)
after a bunch of such operations?

Also, what is the proper procedure for enabling the runtime checks?  I
manually included luauser_tests.h and added ltests.c to my project.  That
seemed to work, but I'm not sure if that is the recommend method.