PDA

View Full Version : How can this be?!?!?



ronwilliams
03-07-2010, 12:19 PM
I have:
A1 = XML.GetValue(strXMLPath.."/audio1")
A2 = XML.GetValue(strXMLPath.."/audio2")
A3 = XML.GetValue(strXMLPath.."/audio3")
A4 = XML.GetValue(strXMLPath.."/audio4")

for x = 1,4 do
AudiClip = "A"..x..""

soo.....AudiClip will be A1 or A2 or A3

Now
btn = Dialog.Message("Selected Audio is:", AudiClip , MB_RETRYCANCEL);
Which gives Selected Audio is: A1
I want the A1 path instead c:\audio\F How?

Sakuya
03-07-2010, 12:53 PM
I have:
A1 = XML.GetValue(strXMLPath.."/audio1")
A2 = XML.GetValue(strXMLPath.."/audio2")
A3 = XML.GetValue(strXMLPath.."/audio3")
A4 = XML.GetValue(strXMLPath.."/audio4")

for x = 1,4 do
AudiClip = "A"..x..""

soo.....AudiClip will be A1 or A2 or A3

Now
btn = Dialog.Message("Selected Audio is:", AudiClip , MB_RETRYCANCEL);
Which gives Selected Audio is: A1
I want the A1 path instead c:\audio\F How?
Variables do not work like this in Lua.

I'm not sure I understand what you want either.

Dermot
03-07-2010, 01:15 PM
A table is the best way to do something like that.


local A = {}
A[1] = XML.GetValue(strXMLPath.."/audio1")
A[2] = XML.GetValue(strXMLPath.."/audio2")
A[3] = XML.GetValue(strXMLPath.."/audio3")
A[4] = XML.GetValue(strXMLPath.."/audio4")

for x = 1,4 do
AudiClip = A[x]
-- "Do what ever"
end

ronwilliams
03-07-2010, 01:49 PM
Thanks, that makes sense! One more problem for me:

I have a path
C:\WINDOWS\system32\1029\Sound\Tree\1\wind.wav

I need it in format

"C:\\WINDOWS\\system32\\1029\\Sound\\Tree\\1\\wind. wav"

Easiest way to achieve this??
Thanks

Ron

Centauri Soldier
03-07-2010, 02:04 PM
sPath = [[C:\WINDOWS\system32\1029\Sound\Tree\1\wind.wav]];

sFormattedPath = String.Replace(sPath, "\\", "\\\\", false);