title: How to pop / clean Lua call stack from C
body: <p>I want to pop / clean the Lua call stack while within a C function called from Lua. Is this possible?  </p>
  
  <p><strong>Background:</strong><br/>
  I want my C library and its extension scripts to use the same test framework. (I am aware various unit testing tools exist for Lua. I don't care; I want one report) I'm wrapping CUnit in a thin layer of Lua. CUnit provides a choice of fatal and non-fatal test assertions. Fatal assertions cause an immediate <code>longjmp</code> out of the test and back into the framework runner. This seems like it would do bad things to the Lua VM if I did not clean the stack first. </p>
  
  <p>The stack will probably look something like:</p>
  
  <pre><code>#0. C:   assert_wrapper_fcn(test, fatal)
  #1. Lua: assert_fcn(bool)
  #2. Lua: test_fcn()
  #3. C:   runner(&amp;test_fcn)
  </code></pre>
  
  <p>I want to clean up everything between #0 and #3. I know the method signatures of <code>test_fcn()</code> and <code>assert_fcn(bool)</code>, but that's it.</p>