lua-users home
lua-l archive

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

On Feb 7, 2006, at 1:24 PM, Jon Gross wrote:

Greetings from a lua newcomer!

I've searched the archive, but haven't found anything that is helpful for a problem I'm having.

I've run into a situation where I have a really long string that I'm reading from a file.

I need to split it up into pieces, that I can later reference (sort of like (foo,bar,baz) = split(/\s/,$str) in perl), so I'm doing this:

local pat = string.rep("baz", 46)

local _,_,foo,bar,bar = string.find(s, pat)

the problem is that whenever I make the pattern contain more than 31 repetitions, lua complains:

lua: ./tcpext.lua:10: too many captures

Is there a limit on the number of captures that you can do? If there is, does anyone have a good way of grabbing more than 31 chunks from a string and assigning those chunks to variables?

I found my problem in lstrlib.c - a quick change, and a recompile, and off I go...

Jon Gross