0

This is my lua script

local r = {}

for _, m in pairs(ARGV) do
  r[#r+1] = redis.call('SISMEMBER', KEYS[1], m)
end

return r

I have a set data type (redis) where I have added some numbers and using lua script to check if a given list of numbers exist in the redis set

I've tested this from command line , verified is the key and the arguments are the numbers , output is as expected, boolean values for each number

$ redis-cli --eval is_contact.lua   verified  , 113232293287 132233325 12344553334
1) (integer) 1
2) (integer) 0
3) (integer) 0

Im trying to invoke this from python , I have tried using lupa

import lupa
lu = lupa.LuaRuntime(unpack_returned_tuples=True)

How do I invoke the lua script and pass arguments ? lu.eval ?

Niharika
  • 1,188
  • 15
  • 37
  • use `subprocess.call` https://docs.python.org/2/library/subprocess.html – ZdaR Feb 07 '17 at 06:30
  • what is the advantage of using subprocess vs lupa? – sr33kant k0n Feb 07 '17 at 06:32
  • It was another method of running your lua script as you have done in cmd, OR you may try this clean and well explained documentation: https://pypi.python.org/pypi/lupa – ZdaR Feb 07 '17 at 06:34
  • Im familiar with subprocess , thank you but I was trying to achieve trough lupa , i have a reason and Im not sure if I want waste your time explaining everything here – sr33kant k0n Feb 07 '17 at 06:38
  • Go ahead with the documentation I linked above, it explains all the important things you may need. – ZdaR Feb 07 '17 at 06:40
  • I have seen the documentation before posting a question here . Doesn't really answer what Im looking for but I guess I will have to give it another reading – sr33kant k0n Feb 07 '17 at 06:45

0 Answers0