且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

LuaSocket,Lua 5.2和Redis

更新时间:2023-02-21 09:40:37

与许多Lua库一样,当前版本的LuaSocket不支持Lua 5.2.对于Lua,该版本第二位的更改表示主要版本,并且不维护向后兼容(在某些情况下,通过编译标志重新启用不赞成使用的功能除外).

The current release of LuaSocket, as many Lua libraries, does not support Lua 5.2. For Lua changes in the second digit of the version indicate major releases, and backwards-compatibility is not maintained (except in some cases via compilation flags to re-enable deprecated features).

Lua 5.1是稳定的,除非您需要5.2中添加的功能,否则没有特别的理由不使用它.

Lua 5.1 is stable, and there is no particular reason not to use it unless you need a feature that was added in 5.2.

也就是说,许多库(包括LuaSocket)目前正在更新为5.2兼容.如果您决心从源代码中进行编译并调整Makefile,请尝试此存储库 LuaSocket的5.2兼容版本.

That said, many libraries are currently being updated to be 5.2-compatible, including LuaSocket. If you are determined and happy to compile from source and tweak makefiles, try this repository which is a 5.2 compatible version of LuaSocket.

请注意,必须为此版本的LuaSocket定义的LUA_COMPAT_MODULE构建了Lua 5.2.您还需要编辑Makefile,以调整系统上正确的路径.

Note that Lua 5.2 must have been built with LUA_COMPAT_MODULE defined for this version of LuaSocket to compile with it. You'll also need to edit the makefiles to adjust for the correct paths on your system.

再给3-4个月左右的时间,我认为许多通用库都将与5.2兼容.但是,我认为除非是很小的东西,否则我认为基于5.2的项目还为时过早.将代码向下移植到5.2并不难(特别是如果您熟悉不推荐使用的功能,因此您可以避免在5.1中过分依赖它们-尤其是setfenv()module()).

Given another 3-4 months or so and I think many of the common libraries will be 5.2 compatible. However in my opinion unless it's small stuff, I think it is early days to be basing projects off 5.2. Porting code to 5.2 down the line is not that hard (especially if you familiarise yourself with the deprecated features so you can avoid depending on them too much in 5.1 - especially setfenv() and module()).