title: How do I access the luaL_loadbuffer name parameter?
body: <p>I've been using the luaL_loadbuffer for many years to load Lua code from within a C++ program. Suddenly I find I need the script to know its own name. Sure, the script in an anonymous function as far as the Lua context is concerned but the C++ framework around it keeps it in a hashmap with a name, the name of the file from which it was loaded to be precise.</p>
  
  <p>I passed that file name into luaL_loadbuffer when I originally wrote the code but I never actually used it. I now need that name so I can have the script compute metrics about its own execution.</p>
  
  <p>luaL_loadbuffer(LuaContext, code, strlen(code), <strong>name</strong>)</p>
  
  <p>I now need to use that <strong>name</strong> from with the Lua context. What's the easiest way to do that?</p>
  
  <p>I'm going to tap the Lua debug function documentation in the meantime while waiting for an answer.</p>