lua-users home
lua-l archive

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


Guess I got C on the brain as I was trying to escape it, but with a "\" instead. Time to read those pattern tutorials more closely.

Thanks, worked the first time.

Mike

On Monday, May 28, 2012, Andrew Starks <andrew.starks@trms.com> wrote:
> On May 28, 2012, at 14:29, Mike McGonagle <mjmogo@gmail.com> wrote:
>
>> OK, I'm stumped... I have a string...
>>
>> "tobj index (0 6 45)"
>>
>> how do I parse the string to get the left paren? I am using string.find and passing a single character which gets used as a pattern. This works fine when passed a "{" or a "<", but it chokes on "(" and "[". I just want to convert the enclosed data to a sub-table.
>>
>> None of the tutorials I have read seem to touch on writing such patterns. If you could lead the way?
>>
>> Mike
>
> You need to escape the paren:
>
> your_string:find("%(")
>
> Does that help?
>
> Lua thinks you're capturing something with your paren.
>
> Andrew Starks
> Co-Founder
> Tightrope Media Systems
>
>