search

Home  >  Q&A  >  body text

nosql - Redis种如何执行lua文件

我看到的所有教程都是用eval 指令后面接一段lua脚本,我尝试eval <lua文件> <参数>时,例如:eval hello.lua 0
提示
“ ERR Error compiling script (new function): user_script:1: '=' expected near 'end'”
即使我的hello.lua文件中只有一句 return "hello world"

高洛峰高洛峰2843 days ago1062

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-04-24 09:12:35

    Excuse my ignorance. Isn't Redis used for caching? Can it still be used to run scripts?
    In addition, the error message said that the end of the statement should be = sign

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-24 09:12:35

    You should use --eval instead of eval when executing

    And please note that the eval command was only added to redis starting from version 2.6.0

    reply
    0
  • Cancelreply