LuaSocket,Lua 5.2和Redis [英] LuaSocket, Lua 5.2 and Redis

查看:112
本文介绍了LuaSocket,Lua 5.2和Redis的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都能够使它们一起工作吗?我已经将5.2很好地工作了,它可以找到lua-redis(redis.lua),但是它无法加载套接字模块,而我似乎无法使用lua(LuaSocket版本2.0.2).任何人都有任何技巧可以使它正常工作吗?

Has anyone been able to get these working together? I've gotten 5.2 working great, and it can find lua-redis (redis.lua), however it fails loading the socket module, which I can't seem to get working with lua (LuaSocket version 2.0.2). Anyone have any tips to get this working?

我尝试制作luasocket,但是它完全失败了,我认为这是由于我的lua版本5.2.

I've tried making luasocket, however it fails completely, which I'm assuming is due to my lua version 5.2.

答案只是恢复到lua 5.1,还是我不知道的另一种解决方法?

Is the answer just to revert back to lua 5.1, or is there another fix that i'm not aware of?

推荐答案

与许多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()).

这篇关于LuaSocket,Lua 5.2和Redis的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆