(错误)ERR 编译脚本出错(new function):user_script:2: 'local' 附近应该有 '='

在我的 Redis 缓存中,我运行了如下命令

SET 12345 JoeDude
SET JoeDude "It works!!"

我有一个 Lua 脚本,它打算从终端运行:

lua
local user=redis.call('GET', KEYS[1])
local output=redis.call('GET', user)
return output

在终端中,我运行了 redis-cli --eval lua_R_and_D.lua 12345

然后我收到了以下错误:(error) ERR Error compiling script (new function): user_script:2: '=' expected near 'local'

请问我做错了什么?

点赞
用户2084798
用户2084798

lua 注释掉,如: --lua 对于 lua 这种语言不是很熟悉,但显然它很适合用于服务器端脚本,而 -- 则是 lua 语言的注释符。

2019-12-27 20:20:30