title: Lua unprotected error using lua_pcall
body: <p>I'm using a Lua Protected call, but I'm getting an unprotected error:</p>
  
  <pre><code>lua_getfield( m_L, LUA_GLOBALSINDEX, "startIteration" );    // 1
  if( lua_isfunction( m_L, -1 ) ){
      lua_pushnumber( m_L, n );                               // 2
      auto ret = lua_pcall( m_L, 1, 0, 0 );                   // 0
      checkLuaReturn( m_L, ret );
  }else{
      lua_pop( m_L, 1 );                                      // 0
  }
  </code></pre>
  
  <p>And the error is:</p>
  
  <pre><code>PANIC: unprotected error in call to Lua API (../example/ex01.lua:31: attempt to index global 'raster' (a nil value))
  </code></pre>
  
  <p>And the Lua code is:</p>
  
  <pre><code>function startIteration( num )
     io.write( "Start iteration " .. num .. "\n" )
     raster.grass.save( "output.png" )
  end
  </code></pre>
  
  <p>How can I solver it, to get a REAL protected call?</p>
  
  <p>update: fixed extra pop</p>