 <p>Shortest form which I have found looks like this:</p> <pre><code>debug.getinfo(1).source:match("@?(.*/)") </code></pre> <p>Index 1, 2- other - depends on which function in call stack you want to query. 1 is last called function (where you're in). If you're running in global context, then probably 2 is more appropriate (haven't tested by myself)</p>