[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: string parsing vs hddtemp question
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 18 Mar 2013 08:44:28 -0300
> for _, mnt,tp,temp,unit in s:gmatch("((/dev/[^|]+)|([^|]+)|([^|]+)|([^|]+)[|]?[^/]+)") do
> print(mnt, tp, temp, unit)
> end
The key to make this simpler is to make the string uniform by appending a
separator at the end and to use - instead of +.
s=s.."|"
for mnt,tp,temp,unit in s:gmatch("|(.-)|(.-)|(.-)|(.-)|") do
print(mnt, tp, temp, unit)
end