lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Is there a way to loop through a string "lines" at a time? Kind of like file:lines(). I am very new to the string library in Lua and I can't get what I want out of the string.

Here is an example of the string:
<Example Start>
s = [[Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtxAdvanced", "gtx\advanced\gtxAdvanced.vcproj", "{0D2A0881-3B05-1E48-B948-C601447B451B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtxComm", "gtx\comm\gtxComm.vcproj", "{15126A50-D89B-AB42-8AA5-4DBB2A200BD1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtxCore", "gtx\core\gtxCore.vcproj", "{2C796755-FDBA-B049-BC46-2210C9ECAA09}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtxDeviceComm", "gtx\devicecomm\gtxDeviceComm.vcproj", "{DEAF4ED7-EC17-5946-90CB-5F6524BACBA6}"
EndProject]]
for vcGUID, pName, pGUID in s:gmatch( "{(.-)}.*(gtxAdvanced).*{(.-)}" ) do
print( "vcGUID->", vcGUID )
print( "pName->", pName )
print( "pGUID->", pGUID )
end
<Example End>

I am trying to find the second UUID between each "Project" and "EndProject", for each line/occurance of the pair, that shows up in the string. Is there a way. I am sure there is but I am beating my head on a wall.
--
Regards,
Ryan
RJP Computing