【问题标题】:(error) ERR Error compiling script (new function): user_script:2: '=' expected near 'local'(错误)ERR错误编译脚本(新功能):user_script:2:'='预期在'local'附近
【发布时间】:2019-12-28 04:20:30
【问题描述】:

在我运行的 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'

什么,请告诉我,我做错了吗?

【问题讨论】:

  • 您在第一个实际语句之前有 lua 这个词。也许把它注释掉?
  • 就是这样!我见过各种以“lua”开头的网页,但是现在运行它时,它会按预期返回数据。

标签: lua redis


【解决方案1】:

注释掉lua,如:--lua 不太熟悉 lua 作为一种语言,但显然它对服务器端脚本很有用,而且 -- 是 lua 语言的注释。

【讨论】:

    猜你喜欢
    • 2020-05-18
    • 2017-11-15
    • 1970-01-01
    • 1970-01-01
    • 2017-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-26
    相关资源
    最近更新 更多