【发布时间】:2021-02-22 10:12:00
【问题描述】:
我设法安装了 luasocket 并且使用 lua5.3 工作正常,但我找不到从 luajit 安装它们的方法。
如果我写 print(_VERSION) 它显示 luajit 使用 lua5.1。
这是我一直在尝试的东西:
luarocks install luasocket
luarocks --local install luasocket
luarocks --lua-version 5.1 install luasocket
luarocks --lua-version 5.1 --local install luasocket
luarocks config lua_version 5.1
luarocks install luasocket
sock = require("/data/data/com.termux/files/home/.luarocks/lib/luarocks/rocks-5.1/socket")
package.path = package.path .. ";/data/data/com.termux/files/home/.luarocks/lib/luarocks/rocks-5.1" require "socket"
package.path = package.path .. ";/data/data/com.termux/files/home/.luarocks/lib/lua/5.1" require "socket"
...
错误:
$ luajit
LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/
JIT: ON ARMv7 VFPv3 fold cse dce fwd dse narrow loop abc sink fuse
> sock = require("socket")
stdin:1: module 'socket' not found:
no field package.preload['socket']
no file './socket.lua'
no file '/data/data/com.termux/files/usr/share/luajit-2.1.0-beta3/socket.lua'
no file '/usr/local/share/lua/5.1/socket.lua'
no file '/usr/local/share/lua/5.1/socket/init.lua'
no file '/data/data/com.termux/files/usr/share/lua/5.1/socket.lua'
no file '/data/data/com.termux/files/usr/share/lua/5.1/socket/init.lua'
no file './socket.so'
no file '/usr/local/lib/lua/5.1/socket.so'
no file '/data/data/com.termux/files/usr/lib/lua/5.1/socket.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
stdin:1: in main chunk
[C]: at 0xaba4406d
我尝试将已安装的文件移动到其中一些路径,但仍然无法正常工作。
【问题讨论】:
标签: lua luajit luarocks luasocket