如何在luasocket 3中使用Lua 5.2 [英] How to use Lua 5.2 with luasocket 3
问题描述
我正在尝试使用Lua
与luasocket
绑定在一起.我是否需要将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屋!