News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
Function to return the current directory
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
RE: Function to return the current directory

As I said I don't have any idea if it works on Windows or Mac, but it *should* do the same on Linux and MacOS...grab everything from the beginning of a string to the final slash (i haven't thought to test with a filename without a slash...i'll need to do that next).

Usage:
my_dir=dirname() --for the dirname of the current script
or
my_other_dir=dirname(some_other_file) -- for the dirname of an external file

If your script is /usr/local/bin/my_script.lua, the first example should return "/usr/local/bin/"
You could also use my_dir=dirname(arg[0]) for the first example, but that's redundant.

Quote:
Did I read John has plans for compiling scripts into executable murgaLua apps?

I think you might already have that ability with Lua proper, but I'm not sure if non-Lua stuff would be supported. As far as I can tell, it looks like something John put on his List Of Things To Explore.

07-17-2007 11:34 PM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
RE: Function to return the current directory - mikshaw - 07-17-2007 11:34 PM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: