如何在luasocket 3中使用Lua 5.2 [英] How to use Lua 5.2 with luasocket 3

查看:123
本文介绍了如何在luasocket 3中使用Lua 5.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 luasocket 3 . ://www.lua.org/download.html> lua 5.2 .问题是,我不确定如何将Lualuasocket绑定在一起.我是否需要将luasocket编译为DLL,然后在lua代码中的某处进行引用,还是应该从lua控制台调用它?

I am trying to compile luasocket 3 that I found on GitHub with lua 5.2. Problem is, I'm not sure how to bind together Lua with luasocket. Do I need to compile luasocket as DLL and then reference if somewhere in lua code, or should I just call it from lua console?

推荐答案

尝试使用 luarocks 进行安装.如果您没有安全帽,请按照网站上的说明进行安装.

Try installing it using luarocks. If you don't have luarocks, install it following instructions on the site.

然后从luasocket存储库下载rockspec文件(luasocket-scm-0.rockspec)并运行

Then download the rockspec file(luasocket-scm-0.rockspec) from luasocket repo and run

$ luarocks install *path to the rockspec file*

如果一切顺利,您将可以使用来自Lua的luasocket,如下所示:

If everything goes OK, you'll be able to use luasocket from Lua like this:

local socket = require "socket"
-- now you can use socket.xxx functions

这篇关于如何在luasocket 3中使用Lua 5.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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