lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Nov 5, 2004, at 11:25 AM, Philip Plumlee wrote:
<x-tad-smaller>Lua d00dz:</x-tad-smaller>
<x-tad-smaller>In Perl, there is some secret punctuation mark, $^ or</x-tad-smaller>
<x-tad-smaller>some such, that reveals the folder path to the current</x-tad-smaller>
<x-tad-smaller>script. If the script were C:/foo/bar.pl, then $^</x-tad-smaller>
<x-tad-smaller>might return C:/foo/ or C:/foo/bar.pl.</x-tad-smaller>
<x-tad-smaller>What's the equivalent, if any, in Lua? Where am I?</x-tad-smaller>
 
<x-tad-smaller>--</x-tad-smaller>
<x-tad-smaller>   Phlip</x-tad-smaller>

There is no guaranteed way of getting this info; you might be executing lua script from a string that was put together in memory by other lua code. However, for the common case of simply loading and executing a text file on disk,
debug.getinfo( 1 )
might get you what you want.

-- Tim Gogolin