invoke lua script from python --lupa

1k Views Asked by At

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 ?

0

There are 0 best solutions below