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

查看:30
本文介绍了如何在 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 安装它.如果您没有 luarocks,请按照网站上的说明进行安装.

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

然后从luasocket repo下载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天全站免登陆