I'm using Redis script by Lua to do some module related to money (http://redis.io/commands/eval). Unfortunately, Redis Lua does not support big decimal type. I searched through the internet and found some library for supporting decimal for lua like lmapm. But unfortunately, I don't know how to install to use it in Redis script.
For a general question, how can I install third party library for Redis script (like https://github.com/amakawa/ohm.lua), because seem like Redis script does not understand some basic function of Lua like "module", and has some restrict like no global variable and function...
Please help me to solve this. I searched around for days but can't find any solution. Thanks so much, I really appreciate!
You can't - Redis' Lua engine does not support the use of external libraries.
The only way around this is to refactor the library and turn it into a Redis script that you can run. The refactored script can then be a part of your script, or you can
SCRIPT LOAD
it and call it from your script using an undocumented feature - in you script call the functionf_sha1
where sha1 is the sha1 hash of the library script (but make sure that youSCRIPT LOAD
the library script first).