以下是演变的过程:
lua
eval
"
return 'haha'
" 0
lua
eval
"
local res = 'haha';
return res;
" 0
lua
eval
"
local value1 = redis.call('get','value1');
local value2 = redis.call('get','value2');
return value1;
" 0
lua
eval
"
return 1 < 2;
" 0
lua
eval " return 1 > 2; " 0
lua
eval " return 1 < 2; " 0
lua
eval " return tonumber('1'); " 0
lua
eval
"
local value1 = tonumber(redis.call('get','value1'));
local value2 = tonumber(redis.call('get','value2'));
return value1 > value2;
" 0
最终的版本
前提是得之前得设置了value1和value2的数值,另外这些值需要是数值类型的,本来就要是对数值进行转换的不要给我整字符过来昂
lua
eval
"
local value1 = tonumber(redis.call('get','value1'));
local value2 = tonumber(redis.call('get','value2'));
return value2 > value1;
" 0
end