I have two sorted sets, I want to separate records from 1st set and store in new list/sorted set by excluding records from 2nd sorted sets.
Below is an example:
set1: 1,2,3,4,5 set2: 3,5,7,8,9
output: 1,2,4
EDIT: I have figured out the way to load the script and use eval to execute script from nodejs.
Strange is when I executed your script even for 5-10 records it taking 1 second to process, which making me doubtful how much scalable it is if I have thousands of records.
Below is my sample nodejs code:
hsetxx = 'redis.call("ZINTERSTORE","temp",2,"set11","set21","weights",1,0) redis.call("ZUNIONSTORE","result",2,"set11","temp","weights",1,-1) redis.call("ZREMRANGEBYSCORE","result",0,0)';
var redis = require('redis');
var client = redis.createClient('14470', connection);
client.on('connect', function() {
    console.log('Connected to Redis');
});
client.script('load',hsetxx,function(err, result) {
     console.log(err+'------------'+result);
 });
client.zadd('set11', 1,1,1,2,1,3,1,4,1,5);
client.zadd('set21', 1,1,1,5);
client.evalsha(
 '39c0da298cab6a6223b4d1e8222cf6d6a84e67b1', //lua source 
 0,
 function(err, result) {
     client.zrange('result', 0, -1, function(err, result) {
          console.log(err+'------------'+result);
      });
 }
);
				
                        
Check this question: