title: How to push a function into _G (gloal space) in Lua
body: <p>TLDR; My functions are not callable from the _G scope, and I want them to be so I can call functions by parsing a list of strings. This could be exacerbated by a <code>package.seeall</code> required by the framework. </p>
  
  <p>I am working in the luci framework, which is an UCI front end for OpenWRT routers. In an attempt to create customized functions that are called when specific UCI values are parsed I have created functions that share the name of the return value which are called through _G. </p>
  
  <p>The parsed data looks something like this:</p>
  
  <pre><code>data = {Name="value"} 
  </code></pre>
  
  <p>I code looks like this:</p>
  
  <pre><code>function main()
      local pageValues={modules={}}
      for i,x in pairs(data) do
          --here is the part that throws the error
          pageValues.modules[x]=_G[x]()
          --also throws error when "newValue=_G[x]()
      end
  end
  
  function value()
  --also does not work with "local function value()"
      return 'YEA'
  end
  </code></pre>
  
  <p>The error I am getting returned to me is <code>attempt to call field '?' (a nil value)</code>
  When I directly pass it the string "value" with <code>pageValues.modules['value']=_G['value']()</code>I receive <code>attempt to call field 'value' (a nil value)</code>
  When is create a dummy variable as such</p>
  
  <pre><code>dummy = 'value'
  pageValues.modules[dummy]=_G[dummy]()
  </code></pre>
  
  <p>I receive <code>attempt to call field '?' (a nil value)</code>. This is the same if I use <code>local dummy = 'value'</code></p>
  
  <p>When I parse <code>_G</code> to see if any of my functions are in it I find that they are not. <strong>NOTE</strong> Luci automatically calls <code>package.seeall</code>, and I don't know if that is what is messing with my global's. But, it may be important in answering this question.</p>
  
  <p>My most urgent need is to get this function running correctly. My secondary interest is in how I can determine the scope in Lua to be able to troubleshot sand-boxing issues in LuCI in the future.</p>