Post subject: Luasockets in BizHawk
WORM
He/Him
Joined: 10/28/2016
Posts: 4
I'm trying to use luasockets in BizHawk 1.11.8.2 and no matter what I try, I can't get it to work. I even saw this answer on stack exchange that says that it's built-in now, but offered no explanation on how to leverage it. Anyone have any idea?
WORM
He/Him
Joined: 10/28/2016
Posts: 4
Thanks to everyone that answered, but I still don't understand
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Doing a quick search, I doubt there's anything done about luasockets at the moment that couldn't be done directly in lua. As zeromus said on stackoverflow+feos, you can checkup this project(thread). This project should support local connection and exchange of messages. If you need help with something in particular, we can probably help, but please give us more details about what you are trying to do.
WORM
He/Him
Joined: 10/28/2016
Posts: 4
All the examples for luasockets start with "socket = require('socket')" and I always get some sort of error. Whether it's "can't find socket" or "loop or previous error loading module 'socket'", I can't work with it until I get that assignment to work. I think that once I get local socket assigned, the rest I can figure out.
Joined: 1/26/2009
Posts: 558
Location: Canada - Québec
Try the following steps: -Download the latest release of BizHawk, unzip the archive somewhere -Delete the "Lua" folder bundled with BizHawk, so we can avoid confusion about the location of the socket folder -Create a "socket" folder next to EmuHawk.exe with the following files inside. You can also get these files from this archive. -Add lua5.1.dll next to EmuHawk.exe. You can also get this file from "Lua 5.1 for Windows"(you can get an installer here). -Create a lua script "test_lua_socket.lua" and put it next to EmuHawk.exe with the following code:
Language: lua

package.cpath = ";./?.dll;" package.path = ";./socket/?.lua;" socket = require('socket') print(_G.socket) print("luasocket is loaded!")
-Start EmuHawk.exe -Drag "test_lua_socket.lua" inside the BizHawk instance. At this point, it should work.
WORM
He/Him
Joined: 10/28/2016
Posts: 4
It sure does. Thank you. That should be enough to get me going.