Questions about using LuaSocket and MD5

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
LÖVE_Noob
Prole
Posts: 3
Joined: Sat Feb 15, 2014 5:26 pm

Questions about using LuaSocket and MD5

Post by LÖVE_Noob »

Hello all,
I am making a game in LÖVE, and I have some questions about using LuaSocket and MD5 (as in, this library.

How do I assemble LuaSocket and MD5, and where do I put it in the game's .love file? As in, should I put certain files in the root of the .love, and some in folders? How do I require() the module into my game?

Will using either module affect how I can distribute the game? I want to have a Windows .exe, an OS X .app, and a standard .love that can run on Linux. I'm wondering if using these will affect the cross-platform compatibility.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Questions about using LuaSocket and MD5

Post by Nixola »

Luasocket is integrated with LOVE already, there's no need to include it. To require MD5, if it's a C lib you'll need to put it in the save directory before you can require it.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
LÖVE_Noob
Prole
Posts: 3
Joined: Sat Feb 15, 2014 5:26 pm

Re: Questions about using LuaSocket and MD5

Post by LÖVE_Noob »

OK, so how do I access LuaSocket? Can I just call it's functions without doing anything, as in, running require("socket.http") and then using it's functions?

And also, how should I assemble MD5 to be able to pop it into the save directory and require it into my game?
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Questions about using LuaSocket and MD5

Post by Nixola »

About Luasocket yeah, you just requre 'socket' or 'socket.http' and you're good to go. For MD5, if it's a C lib, put the .dll, .so and .dylib (was that for OSX) in the .love file, then do this:

Code: Select all

love.filesystem.write('md5.dll', love.filesystem.read('md5.dll'))
love.filesystem.write('md5.so', love.filesystem.read('md5.so'))
love.filesystem.write('md5.dylib', love.filesystem.read('md5.dylib'))
--path inside the .love file ↑↑ | path in the save directory ↑↑
Just once, to get them in the save directory, then just require 'md5'
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
LÖVE_Noob
Prole
Posts: 3
Joined: Sat Feb 15, 2014 5:26 pm

Re: Questions about using LuaSocket and MD5

Post by LÖVE_Noob »

I'm probably being a real idiöt here, but is there a page where I can get those files, or do I have to manually compile the project from source? And also, can I put those files in a folder, as in like this:

Code: Select all

love.filesystem.write('libraries/md5/md5.dll', love.filesystem.read('libraries/md5/md5.dll'))
love.filesystem.write('libraries/md5/md5.so', love.filesystem.read('libraries/md5/md5.so'))
love.filesystem.write('libraries/md5/md5.dylib', love.filesystem.read('libraries/md5/md5.dylib'))
require("libraries/md5/md5")
Thanks for all the help,
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Questions about using LuaSocket and MD5

Post by Nixola »

Sure you can change the folder, that was just an example. About getting those files, check on the library website
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
_Yank
Prole
Posts: 8
Joined: Thu Feb 20, 2014 8:34 pm

Re: Questions about using LuaSocket and MD5

Post by _Yank »

Well if you're using MD5 to do encryption I recommend you to use the ENet Library (http://leafo.net/lua-enet/).
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Questions about using LuaSocket and MD5

Post by Nixola »

Nice fact: LuaEnet is included in LÖVE too
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 222 guests