title: Lua Getting Result Back in LuaJava from Lua function call
body: <p>How does one get the value back from a Lua function call in LuaJava.</p>
  
  <p>Lets say I have calc.lua:</p>
  
  <pre><code>function foo(n) return n*2 end
  </code></pre>
  
  <p>I call the function in Java as follows:</p>
  
  <pre><code>LuaState luaState;
  this.luaState = LuaStateFactory.newLuaState();
  this.luaState.openLibs();
  this.luaState.LdoFile("calc.lua");
  this.luaState.getGlobal("foo");
  this.luaState.pushNumber(5.0);
  int retcode=this.luaState.pcall(1, 1,0);
  </code></pre>
  
  <p>Now what do I have to call on LuaState object to get the result of this last function call foo(5)?  </p>
  
  <p>Is there an example somewhere showing Java->Lua invocation with return values from the call?</p>