tags:

views:

301

answers:

3

How can I free the lua stack?

+2  A: 

I think you need lua_remove? I just skimmed over the manual, not sure if there's a "clear whole stack" function.

void lua_remove (lua_State *L, int index);

Removes the element at the given valid index, shifting down the elements above this index to fill the gap. Cannot be called with a pseudo-index, because a pseudo-index is not an actual stack position.

Mark Rushakoff
+3  A: 

Basically, the only way I know for freeing the whole lua stack is calling lua_close on the lua_State instance.

Bluehorn
+2  A: 
Alexander Gladysh