Search code examples
socketslualuasocketlua-scripting-library

when I write require("socket"), error occurs


when I write

socket = require("socket")

This error occurs. How can I fix this errors? maybe I think this problem is about luasocket.

        no field package.preload['socket.core']
        no file '.\socket\core.lua'
        no file 'e:\Program Files\Algoryx\AgX-2.15.0.4\bin\x64\lua\socket\core.l
ua'
        no file 'e:\Program Files\Algoryx\AgX-2.15.0.4\bin\x64\lua\socket\core\i
nit.lua'
        no file 'e:\Program Files\Algoryx\AgX-2.15.0.4\bin\x64\socket\core.lua'
        no file 'e:\Program Files\Algoryx\AgX-2.15.0.4\bin\x64\socket\core\init.
lua'
        no file 'e:\Program Files (x86)\Lua\5.1\lua\socket\core.luac'
        no file '.\socket\core.dll'
        no file 'e:\Program Files\Algoryx\AgX-2.15.0.4\bin\x64\socket\core.dll'
        no file 'e:\Program Files\Algoryx\AgX-2.15.0.4\bin\x64\loadall.dll'
        no file '.\socket.dll'
        no file 'e:\Program Files\Algoryx\AgX-2.15.0.4\bin\x64\socket.dll'
        no file 'e:\Program Files\Algoryx\AgX-2.15.0.4\bin\x64\loadall.dll'

Solution

  • You are missing a dynamic library (usually comes as socket\core.dll) that is required for luasocket to work. You need to have a version of that library compiled for your version of Lua (whether it's Lua 5.1, 5.2 or 5.3) and for your architecture (x86 or x64). Since you seem to be using a particular product (Algoryx), you may want to check with the authors how they handle luasocket integration.