Unfortunately, the directory isn't easily available from script.
now in the trunk, see below.
You can look at http://trac.assembla.com/chdk/browser/trunk/core/raw.c#L120
to see how the raw code makes a raw filename matching the most recent jpeg name. The get_target_file_num() doesn't actually use quite the same code as get_exp_count() but it looks like it should be equivalent (might vary on some cameras though)
For cameras that use numbered directories, you can emulate get_target_dir_num() using get_parameter_data with the appropriate param. For cameras that use date naming, there isn't any way to get it that I know of. You could list the DCIM directory and try to pick the right one.
This should really be made into a generic function that returns a string to lua, since all the necessary code already exists. I'll look into doing this, it's been on my todo list for a while.
trunk changeset 2225
adds get_image_dir(). The following lua should give you the full path of the most recently shot jpeg
This will be available on http://mighty-hoernsche.de/trunk/
I haven't checked this on cameras with date folder naming, but if "raw in dir with jpeg" worked, so should this.
I don't know exactly when the counters change, so I'd be cautious using it in the middle of the shooting process.