Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua environmental differences #183

Open
bmerry opened this issue Mar 23, 2018 · 4 comments
Open

Lua environmental differences #183

bmerry opened this issue Mar 23, 2018 · 4 comments

Comments

@bmerry
Copy link
Collaborator

bmerry commented Mar 23, 2018

The Lua scripting support (EVAL) does not perfectly emulate the environment available to a real redis script. Some known differences are:

  • Libraries such as cjson are not loaded
  • Setting of global variables is only checked each time a redis function is called, rather than being enforced by a metatable.
  • dofile and readfile are not disabled.
  • Various functions on the redis object are not implemented e.g. redis.sha1hex, redis.log
  • It doesn't prevent mutating commands after a random command (this will be a major task since it requires knowing which commands are mutating and/or random).
  • The random seed might not be reset with every script (untested)

For more details see the redis documentation and implementation.

@M1ha-Shvn
Copy link

Also found my scripts not working, as it requires cjson. I get attempt to index a nil value (global 'cjson') error

@alifhughes
Copy link

alifhughes commented Feb 14, 2020

Just wondering if any new release planning to address the first point?

  • Libraries such as cjson are not loaded

@bmerry
Copy link
Collaborator Author

bmerry commented Feb 14, 2020

Just wondering if any new release planning to address the first point?

I'm afraid I don't get enough time to spend on fakeredis to make it better (mostly I just try to keep it working as new versions of dependencies come out), and I'm not sure quite what would be involved since I don't use Lua myself. Pull requests are welcome.

@alifhughes
Copy link

No worries, thanks for getting back to me quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants