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 
"murgaLua -e string" in Windows and Mac
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
RE: "murgaLua -e string" in Windows and Mac

Ok, if it works on Windows there is something else causing the problem.
Specifically what I'm trying to do is run a separate murgaLua process that runs a new script using a variable created in the current script. This is what I have working in Linux:

Code:
io.popen(MURGALUA.." -e 'images=\""..images.."\"' "..tempfile)

MURGALUA is the murgaLua executable
tempfile is a dynamically created script file
images is a Lua variable being passed, which is a directory that tempfile wouldn't be able to find otherwise.
If I recall correctly, I got a "bad symbol" error in Windows.

This also works in Linux, but I haven't yet tested in Windows:

Code:
io.popen(MURGALUA..[[ -e 'images="]]..images..[["' ]]..tempfile)


Maybe there is a problem with the string being interpreted first for io.popen and then being misinterpreted when it's run. It might end up being sent in this format:

Quote:
lua -e 'var="string"' -- works on Linux but not on Windows

If that's the case, I think it might be a problem with using a backslash escape after all.
It looks like one option could be something like this:

Code:
io.popen(MURGALUA..' -e "images=\"'..images..'\"" '..tempfile)

which I hope would run this command:

Code:
murgaLua -e "images=\"<images path>\"" <new script>

However, I could see it doing this instead:

Code:
murgaLua -e "images="<images path>"" <new script>

which I guess would probably also fail.

Perhaps the best solution would be

Code:
io.popen(MURGALUA..[[ -e "images=']]..images..[['" ]]..tempfile)

which is essentially the same as the second one above but with the single and double quotes swapped, hopefully resulting in this:

Code:
murgaLua -e "images='<images path>'" <new script>

That one looks like it should work in Windows.

02-22-2008 08:55 PM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
RE: "murgaLua -e string" in Windows and Mac - mikshaw - 02-22-2008 08:55 PM

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

Forum Jump: