HI,
I have created LUA script:
function handler(document)
local audienceField = document:findField('AUDIENCE2')
if audienceField then
dataFieldvalue = document:fieldGetValue(audienceField)
result=strsplit(',', dataFieldvalue)
for key,value in pairs(result) do
document:addField('AUDIENCE',value)
end
end
end
function strsplit(delimiter, text)
local list = {}
local pos = 1
if string.find("", delimiter, 1) then
return nil
end
while 1 do
local first, last = string.find(text, delimiter, pos)
if first then
table.insert(list, string.sub(text, pos, first-1))
pos = last+1
else
table.insert(list, string.sub(text, pos))
break
end
end
return list
end
The problem is when I run it I'm receiving two errors:
1. On win xp it is: 13/04/2010 17:02:07 [Lua - TestLuaTask] Script error: not enough memory
2. On Win 2008 64 bit: 13/04/2010 12:23:45 [Lua - TestLuaTask] Script error: table overflow
Do you have any idea why it is happening? :)
I have created LUA script:
function handler(document)
local audienceField = document:findField('AUDIENCE2')
if audienceField then
dataFieldvalue = document:fieldGetValue(audienceField)
result=strsplit(',', dataFieldvalue)
for key,value in pairs(result) do
document:addField('AUDIENCE',value)
end
end
end
function strsplit(delimiter, text)
local list = {}
local pos = 1
if string.find("", delimiter, 1) then
return nil
end
while 1 do
local first, last = string.find(text, delimiter, pos)
if first then
table.insert(list, string.sub(text, pos, first-1))
pos = last+1
else
table.insert(list, string.sub(text, pos))
break
end
end
return list
end
The problem is when I run it I'm receiving two errors:
1. On win xp it is: 13/04/2010 17:02:07 [Lua - TestLuaTask] Script error: not enough memory
2. On Win 2008 64 bit: 13/04/2010 12:23:45 [Lua - TestLuaTask] Script error: table overflow
Do you have any idea why it is happening? :)