|
Hi LuizThe scriptlooks as below
function modify_content_length(msg, length)
local offset = string.find(msg, "Content-Length", 1, true)
if(offset == nil) then
else
print("offset = " , offset)
print(s:gsub("(Content%-Length%s*:%s*)\r","%1"..n.."\r"))
end
end
msg = [===["INVITE\r\nContent-Length:\r\n\r\nv=0\r\n]===]
modify_content_length(msg, string.len(msg))When I execute I get below error
lua5.2: string_test.lua:9: attempt to index global 's' (a nil value)
stack traceback:
string_test.lua:9: in function 'modify_content_length'
string_test.lua:18: in main chunk
[C]: in ?RegardsAustin
On Thu, Jun 26, 2014 at 7:26 AM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
Try s:gsub("(Content%-Length%s*:%s*)\r","%1"..n.."\r")