i'm trying to run the following lua script in redis:
for j=0,5000 do
local i=redis.pcall('incr', 'SS:'..ARGV[2])%5000
if redis.pcall('sismember', 'S:', i)==0 then
if i > 4999 then
redis.pcall('set', "SS:"..ARGV[2], 1)
i = 1
end
end
if redis.pcall('get', 'SS:'..ARGV[2])>4 then
return 'forbiden'
end
redis.pcall('incr', 'C:'..ARGV[1])
redis.pcall('sadd', 'US:'..ARGV[2], ARGV[1]..':'..i)
redis.pcall('sadd', 'U:'..ARGV[1], ARGV[2]..':'..i)
redis.pcall('sadd', 'S:'..ARGV[2], i)
return i
end
end
return false
but i am getting this error:
Error compiling script (new function): user_script:20: '' expected near 'end'
i'm trying moving this end, tabulations, but i can't get it working, sorry if this is a dumb question, i'am really new at this lua thing!
end- karthikr