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

Posts: 231
Group: Moderators
Joined: Apr 2007
Status: Offline
Reputation: 0
Post: #1
RE: Function to return the current directory

Ok I was initially getting a blank when checking dirname at the start of a script, once the script was running it returned the path of the script, but ideally whats needed is the path to the murgaLua executable.

What I have is an application bundle that launches murgaLua, special thanks to Marielle for going through the Xcode tutorial and developing it. Here's what it looks like at the desktop, a peek inside the package, and running.

The 'main.scpt' is an Applescript that originally simply launched murgaLua and a file called script.lua. I keep this script seperate from Lua scripts as it truly belongs to the Applescript executable "applet" and not to murgaLua.

In the script I added a step to write the current application path to a file which
murgaLua will load and set a global variable "bundleroot"
You can see the Applescript here

It generates file bundleroot.lua:


start.lua at its most basic:

if bundleroot==nil then os.exit() end

Console.lua loads the directory contents of Data/Scripts/ into a menu
and the callback of that menu feeds the whole path of the chosen
script to a dofile command.  The console script also re-directs all print
commands into the console output so I don't have to find another app to
see what is happening.

iGame3D has an engine level method of finding the path to itself:

bundleroot=getSceneInfo(IG3D_ROOT) --  retrieves application path

--- by default I script in this variable immediately after:

--bundleroot doesn't get changed , gameroot can be set by the user:


Now I have somewhat the same functionality in a standalone murgaLua solution
and a fairly snappy murgaLua script launching mechanism.

Now to figure out dynamic submenus and clean up that scripts folder.

07-18-2007 02:53 PM
Visit this user's website 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 - iGame3D - 07-18-2007 02:53 PM

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

Forum Jump: