title: Get name of argument of function in lua
body: <p>When call a lua function like</p>
  
  <p>PrintMe(MyVariableName)</p>
  
  <p>I would like to be able to actually print "MyVariableName" and not it's value(well, for demo purposes).</p>
  
  <p>Obviously I could just pass the string but that requires extra quotes and I also would like to print it's value.</p>
  
  <p>e.g., </p>
  
  <pre><code>MyVariable = 4
  PrintVariable(MyVariable)
  </code></pre>
  
  <p>Would print "MyVariable is 4" or whatever</p>
  
  <p>I do not want to have to duplicate the name and variable like</p>
  
  <pre><code>PrintVariable(MyVariable, "MyVariable")
  </code></pre>
  
  <p>as this is unnecessary duplication.</p>
  
  <p>Can lua handle it?</p>
  
  <p>What I'm doing now is passing the variable name in quotes and using loadstring to get the value but I would like to just pass the variable directly without the extra unnecessary quotes(which I thought debug.getlocal did but it ends up returning the value instead of the name).</p>
  
  <hr>
  
  <p>Here is mock example</p>
  
  <pre><code>function printme1(var, val)
      print(var.." = "..val)
  end
  
  function printme2(v)
      local r
      loadstring("r = "..v)() -- equivalent to r = a but must be used since v is a string representing a and not the object a
      print(v.." = "..tostring(r))
  end
  
  function printme3(v)
      -- unknown
  end
  
  a = 3
  
  printme1("a", a)
  printme2("a")
  printme3(a) 
  </code></pre>
  
  <p>In this case all 3 should print the same thing. printme3 obviously is the most convenient.</p>