lua-users home
lua-l archive

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


Alex Bradbury <asb@asbradbury.org> writes:
>> Wouldn't argv[0] that is given to main() work for Linux?
>> I guess in the situation where luajit is .so, .dll, or .dylib that won't be
>> easy. But maybe there is a compiler specific global __argv, etc.
>
> I don't think you can guarantee argv[0] is always set appropriately
> (though it will be for anything launched from a shell). The logic is
> more complicated - you'd have to check in cwd, then through every path
> in $PATH.

... and even then, it's not guaranteed, though it will work in "typical"
usage.

-miles

-- 
Neighbor, n. One whom we are commanded to love as ourselves, and who does all
he knows how to make us disobedient.