title: How to Convert a string to lua code to read value from nested table
body: <p>I have a configurable value of a table fetch function which i get as an input string. I need that string to be executed as a code and fetch a value from the nested table.</p>
  
  <p>I tried using <code>load(string)</code>, its not working </p>
  
  <pre><code>local function main()
    local t = {
      ["name1"] = "value1",
      ["name2"] = {["name1"] = "value1",
        ["name2"] = { 1, false, true, 23.54, "a \021 string" },
        name3 = nil
      },
      name3 = nil
    }
    local string = 't.name2.name1'
    print(type(string))
    print(load(string))
  end
  </code></pre>
  
  <p><code>print(load(string))</code> should print <code>value1</code>.</p>