0

After Reading this, downloading the x64 binary of socket and replacing them in the lua "clibs" directory, with no positive results, I would like some help on resolving the following error that i'm receiving from eclipse:

Exception in thread "main" com.naef.jnlua.LuaRuntimeException: error loading module 'socket.core' from file 'C:\Program Files (x86)\Lua\5.1\clibs\socket\core.dll':
    %1 is not a valid Win32 application.

    at com.naef.jnlua.LuaState.lua_pcall(Native Method)
    at com.naef.jnlua.LuaState.call(LuaState.java:555)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.run(JNLua51Launcher.java:128)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.main(JNLua51Launcher.java:143)

This is my enviorioment:

  • Windows 10 x64;
  • Lua 5.3;
  • LUA_PATH is defined corretly;
  • LUA_CPATH is defined corretly;

Here is my code:

-- Requires
local socket = require 'socket'

-- Settings
host = "localhost"
port = 8384;

-- Program Start
print("Program Start")

-- Functions

local function main()

client = socket.connect(host, port)
client:send("test!")
while true do
  s, status, partial = client:receive(1024)
  print(s or partial)
  if status == "closed" then 
    break 
  end
end
client:close()

end

main()
Ygor Montenegro
  • 659
  • 1
  • 12
  • 26

1 Answers1

0

From the file path of your Lua installation (C:\Program Files (x86)\Lua\5.1\clibs\socket\core.dll), it looks like you have installed a 32-bit version of Lua, and are trying to load a 64-bit DLL with it. This won't work; the two architectures cannot be mixed in one process.

Either download the 32-bit version of the socket module or the 64-bit version of the Lua interpreter.

Colonel Thirty Two
  • 23,953
  • 8
  • 45
  • 85
  • Just downloaded from here: http://files.luaforge.net/releases/luasocket/luasocket/luasocket-2.0.2 and here: http://luabinaries.sourceforge.net/download.html replaced all the files, left everything in 32bits with the same result – Ygor Montenegro Nov 14 '16 at 14:31