在redis里,直接执行命令是没有报错的:
127.0.0.1:6379> script load 'return redis.call("get", "k1")'
"a1a3bcdf20b0233280ae05d9e185af76add0fed8"
但在openresty里执行:
local redis_script = 'return redis.call("get", "k1")'
local ok, err = redis_conn.script("load", redis_script)
第2行报错如下:
2018/11/19 16:47:47 [error] 18420#18420: *11 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/redis.lua:238: bad argument #1 to 'rawget' (table expected, got string)
stack traceback:
coroutine 0:
[C]: in function 'rawget'
/usr/local/openresty/lualib/resty/redis.lua:238: in function 'script'
请问script命令的格式要怎样写?