title: Is there a lua-c api function which doesn't remove the complete stack?
body: <p>My problem is that lua_pcall clears the stack, because i want to reuse the stack before the call again with just one change again.<br>
   Is there a way to either copy the complete stack and paste it in again or even a way to call a lua function without clearing the stack?</p>
  
  <p>Lua:</p>
  
  <pre class="lang-lua prettyprint-override"><code>function test(a)
      print(a)
  end
  
  event.add("test", test)
  event.add("test", test)
  
  event.call("test", 42)
  </code></pre>
  
  <p>C++:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>int Func_Event_call(Lua_State* L){
  
      //Stack: String:Eventname, Arguments...
  
      std::string name = luaL_checkstring(L, 1);
  
      ... Get array functions from name
  
      for(...){
  
          //load function into stack
          lua_rawgeti(L, LUA_REGISTRYINDEX, functions[c]);
          lua_replace(L, 1);
  
          //Wanted Stack: Lua_Function, Arguments... &lt;- works for the first function
  
          //call function
          lua_pcall(L, nummberArgs, 0, 0);
  
          //stack is now empty because of lua_pcall &lt;- problem
      }
  
      return 0;
  }
  </code></pre>