title: how to get the closure in lua?
body: <p>suppose i have a file name "test.lua" containing lines below:</p>
  
  <pre><code>--[[  test.lua --]]
  local f = function()
    print"local function f in test.lua"
  end
  
  f_generate = function()
    local fun = loadstring(" f()")
  -- local env = getfenv(1)
  -- set(fun,env)
    return fun
  end
  f_generate()()
  --[[ end of test.lua--]]
  </code></pre>
  
  <p>because loadstring doing its stuff under the global environment, so when i call 
    f_generate()()
  i will get an error "attempt to call global 'f' (a nil value)"</p>
  
  <p>the code commented out shows that function environment can't deal with this problem.</p>
  
  <p>cause table is the only data structure in lua, (and function environment and other lots of thing are implement by table), i think is reasonable to assume that the closure are also implement by table, but how can i get it?</p>