如何要求Lua套接字? [英] How To Require Lua Socket?

查看:115
本文介绍了如何要求Lua套接字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对通过文件操作进行lua开发非常陌生,现在根据

解决方案

我不知道您的配置详细信息,但是请尝试

  require("src.socket") 

您应该从lib的根路径中获取一个模块

I'm very new to lua development with file manipulation, and now trying to import the lua socket package into my project according to this post, but I can't run even the code below.

I guess the error message indicates I need to import not only the socket.lua but also .\socket\core (probably .dll, since it doesn't have core.lua), while a reply at the post suggested importing only the file.

I'm stuck in just the beginning... What do I have to do for the next step?

local function main()
  local socket = require("socket")
end
main()

Exception in thread "main" com.naef.jnlua.LuaRuntimeException: ...n32.win32.x86_64\workspace\TestForCiv\src\socket.lua:13: module 'socket.core' not found:
    no field package.preload['socket.core']
    no file '.\socket\core.lua'
    no file 'C:\Program Files\Java\jre1.8.0_151\bin\lua\socket\core.lua'
    no file 'C:\Program Files\Java\jre1.8.0_151\bin\lua\socket\core\init.lua'
    ...(a bunch of no file errors continues)

Edit: I added the folder structure. Even I add the .dll file it returns the same error.

解决方案

I don't know the details of you configuration, but try this

require ("src.socket")

you should require a module from the root path of the lib

这篇关于如何要求Lua套接字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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