Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add luasocket support #458

Closed
Sn0wCrack opened this issue Jul 13, 2015 · 9 comments
Closed

Add luasocket support #458

Sn0wCrack opened this issue Jul 13, 2015 · 9 comments
Labels
re: Lua API/scripting Relating to EmuHawk's Lua API (not the Lua Console)

Comments

@Sn0wCrack
Copy link

If it would be possible to add luasocket support directly into the BizHawk lua interpreter.

@10ktris
Copy link

10ktris commented Aug 4, 2015

@Sn0wCrack It's possible to use the 0MQ lua binding with Bizhawk. It's not TCP but better than nothing.

@zeromus
Copy link
Contributor

zeromus commented Aug 31, 2015

if bizhawk's lua can load the luasocket dll then we won't be integrating it. i don't know what the status is of bizhawk's lua loading dlls.

@vadosnaprimer
Copy link
Contributor

Using this example, I couldn't access any socket functions:
http://www.lua.org/pil/8.2.html

I put luasocket.dll (and what it comes with) in the EmuHawk.exe folder, and this code

socket = assert(package.loadlib("luasocket.dll", "luaopen_socket"))
socket()

crashes the emu. Without socket() it works, but what's the point then.

Lua version of socket library works fine.

@zeromus
Copy link
Contributor

zeromus commented Feb 2, 2016

check stackoverflow, theres a post about it. it isnt easy.

@vadosnaprimer
Copy link
Contributor

If you mean yours, it refers to lua version of sockets (as do all stackoverflow questioins), not dll (that comes with beta releases). There were some general advices how to load dlls, but they refer to very unclear docs that provide zero samples. So the only example code I found didn't work. Right now I'm getting LuaInterface.LuaScriptException: userdata with the above code. And as I said, non-beta releases provide lua version sockets, and it works by simply using socket = require("socket").

@zeromus
Copy link
Contributor

zeromus commented Feb 2, 2016

So dont use the beta releases which dont make sense with the instructions I put on stackoverflow.

I just followed my instructions again, and it worked perfectly. I added socket = require("socket"); print(socket); and it worked perfectly. Then, believe it or not, I repeated these steps on the latest git code and it worked perfectly. Why butt your head against it? Do it the way I worked out.

@vadosnaprimer
Copy link
Contributor

I know this one works. But you mentioned loading luasocket.dll, and that's what I also tried.
"socket.lua": http://files.luaforge.net/releases/luasocket/luasocket/luasocket-2.0.2
"luasocket.dll": http://files.luaforge.net/releases/luasocket/luasocket/luasocket-2.0-beta2-win32

Yes, the first one still has core.dll, but it also has sockets.lua, and it's exactly what allows plugging it in via socket = require("socket"). The second one only has luasockets.dll, so it requires precisely loading the dll itself, and it's what's not working. I honestly don't care as long as there's a way to use sockets with no problem. But the issue addresses embedding luasockets.dll, and you said we might be embedding it if it doesn't load already. So it's funny: it doesn't quite load, but you can use sockets the other way, which is probably what people don't want, but I don't know for sure.

@zeromus
Copy link
Contributor

zeromus commented Feb 3, 2016

I don't care why one works or doesn't either, as long as one of them works, somehow. Our lua is garbage. All lua is garbage. It's a miracle if a module EVER works, ANYWHERE. This bug is old and predates my discovery there's another way besides loading the dll to get luasockets running. Who cares about the damn dll.

@zeromus zeromus closed this as completed Feb 3, 2016
@YoshiRulz YoshiRulz added the re: Lua API/scripting Relating to EmuHawk's Lua API (not the Lua Console) label Feb 7, 2019
@YoshiRulz
Copy link
Member

see #1080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
re: Lua API/scripting Relating to EmuHawk's Lua API (not the Lua Console)
Projects
None yet
Development

No branches or pull requests

5 participants