lua-users home
lua-l archive

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


于 2012-8-17 23:40, Maha Akkari 写道:
thank u for ur  reply,

here is the sPP  code from the .lua file

function sPP(t)    -- t is an array passed from c++ to Lua
  for j=1,#t do
     table.insert(pp, t[j])
  end
  writeCppArrayToLuaFile(4,pp) -- writes the contents of pp table on the fourth line of lua file.
end


your help is highly appreciated because i am not stuck

well, your code above does not give much clue where the problem is.
the 'too many captures' error is related with Lua's pattern matching functionality from the string library.
maybe some stack trace information would be helpful to locate the problematic code.


making the config `LUA_MAXCAPTURES' big enough may be a workaround,
however, I think a better solution would not be making changes to Lua but modifying your own code.

in practice, I think, we don't want so many captures. your should re-design your code.
the match function from the string library would return all captures onto the stack, so anyway,
we have a hard limit on LUA_MAXCAPTURES, similar to the limit on local variables of a function.