title: How could I access local variables or call local functions in lua scripts from C/C++?
body: <p>If I define a "local" function, as such:</p>
  
  <p>local function Dispatch(archive)
    coroutine.resume(yielder)
  end</p>
  
  <p>...and I want to call this function from C++, I do not think I can use the
  lua_getglobal() call:</p>
  
  <pre><code>m_pThreadState = lua_newthread(m_MasterLuaState);
  //Load/define the above "Dispatch" routine local to this thread.
  luaL_loadbuffer(m_pThreadState, m_ScriptBody, strlen(m_ScriptBody),"Console");
  lua_getglobal(m_pThreadState, "Dispatch"); //UH-OH!! PROBLEM HERE!!
  lua_pcall(m_pThreadState, 1, 0, 0);
  </code></pre>
  
  <p>So how do I specify/push the local function "Dispatch" in preperation for
  the call?  Again, I assume I cannot use the lua_getglobal() call, because
  the "Dispatch" function is defined as "local" to the m_pThreadState.  What
  do I do?</p>