lua-users home
lua-l archive

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


On Wed, 2 Apr 2008 09:43:59 +0100
"Robert Raschke" <rtrlists@googlemail.com> wrote:

> On 4/1/08, Michael Elliott <melliott42@yahoo.com> wrote:
> > How can I get just the current scriptname without the
> > path (hello.lua)?
> 
> I use these a lot (work on both unix and windows style pathnames):
nope, it doesn't.

print(dirname("x/y/z/abc\\def"));
print(basename("x/y/z/abc\\def"));

x/y/z/abc
def

it is totally wrong on Linux, 'cause "abc\def" is a perfectly
acceptable *file* name, not path+filename.