nrk / redis-lua

A Lua client library for the redis key value storage system.
MIT License
733 stars 239 forks source link

The lettercase of the package name and the file base name mismatch #13

Closed agentzh closed 12 years ago

agentzh commented 12 years ago

The package name is "Redis" while the file name is "redis.lua", which breaks usage like below:

local Redis = require "redis"
local redis = Redis.connect(...)

We'll get the error message: "attempt to index local 'Redis' (a boolean value)".

Hopefully you can do me a favor by fixing this ;)

Thanks! -agentzh

nrk commented 12 years ago

Yeah, in redis.lua we should return a table (the actual module), instead we set Redis as a global variable which is actually not a good practice. This issue will definitely get fixed in the next major release, in the meanwhile I wonder if adding an additional return Redis in redis.lua might help. I don't want to remove the global Redis yet to avoid breaking existing code until a new major release is out.

nrk commented 12 years ago

Finally fixed in master, this change will be available starting from redis-lua v2.0.3. The Redis global alias is still available for backwards compatibility but it has been deprecated and it will be removed in the next major version, so from now on you should always use:

local redis = require 'redis'

Thanks.

agentzh commented 12 years ago

Thank you!

Best, -agentzh