MySQL?

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.
Freze
Prole
Posts: 9
Joined: Wed Apr 13, 2011 1:15 pm

MySQL?

Post by Freze » Thu Apr 14, 2011 4:17 pm

Any way to connect a MySQL Server to the program?
A module or something?

mysql.connect(host, user, pass, database, port) and
mysql.query(query)

Anything like that?
Thanks :)

User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: MySQL?

Post by nevon » Thu Apr 14, 2011 5:10 pm

You could use luaSQL.

User avatar
BlackBulletIV
Inner party member
Posts: 1260
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: MySQL?

Post by BlackBulletIV » Thu Apr 14, 2011 8:34 pm

nevon wrote:You could use luaSQL.
Though you would have to add it in to your own copy of the LOVE source files, and then compile your own version. That is, if you wanted to use it with LOVE.

User avatar
miko
Party member
Posts: 409
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: MySQL?

Post by miko » Thu Apr 14, 2011 11:46 pm

BlackBulletIV wrote:
nevon wrote:You could use luaSQL.
Though you would have to add it in to your own copy of the LOVE source files, and then compile your own version. That is, if you wanted to use it with LOVE.
Lua can load modules dynamically. So if lua can load a module, then love could do it also. You just need to put your (binary or lua) module within package.cpath/package.path respectively. If you want to distribute your game, then you would need to distribute those libraries as well (and for every platform you intend to support).
But then it would be better to statically compile your own love2d indeed.

BTW, I wish love2d had sqlite compiled in...
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples

User avatar
ishkabible
Party member
Posts: 241
Joined: Sat Oct 23, 2010 7:34 pm
Location: Kansas USA

Re: MySQL?

Post by ishkabible » Fri Apr 15, 2011 1:03 am

yep, it works quite well in fact. i used a profiler library with it too.

User avatar
BlackBulletIV
Inner party member
Posts: 1260
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: MySQL?

Post by BlackBulletIV » Fri Apr 15, 2011 1:15 am

miko wrote:
BlackBulletIV wrote:
nevon wrote:You could use luaSQL.
Though you would have to add it in to your own copy of the LOVE source files, and then compile your own version. That is, if you wanted to use it with LOVE.
Lua can load modules dynamically. So if lua can load a module, then love could do it also. You just need to put your (binary or lua) module within package.cpath/package.path respectively. If you want to distribute your game, then you would need to distribute those libraries as well (and for every platform you intend to support).
Oh, well that's cool then.

User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: MySQL?

Post by kikito » Fri Apr 15, 2011 6:02 am

I'd try using simple Lua files before attempting to use databases. Lua is flexible enough to express both game logic and game data cleanly.
When I write def I mean function.

User avatar
Taehl
Dreaming in associative arrays
Posts: 1024
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: MySQL?

Post by Taehl » Sat Apr 16, 2011 4:26 am

I agree with kikito. Why do you need to use SQL databases? Unless it's something REALLY advanced, you should have no problem expressing your data with Lua tables (they really are amazing, I assure you).
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.

User avatar
BlackBulletIV
Inner party member
Posts: 1260
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: MySQL?

Post by BlackBulletIV » Sat Apr 16, 2011 9:01 am

Taehl wrote:I agree with kikito. Why do you need to use SQL databases? Unless it's something REALLY advanced, you should have no problem expressing your data with Lua tables (they really are amazing, I assure you).
I agree. You can store data using Lua table syntax in text files, and bring them back into data by using love.filesystem.read and then loadstring. You could also use loadfile or dofile, but this doesn't work in SELOVE.

User avatar
schme16
Party member
Posts: 127
Joined: Thu Oct 02, 2008 2:46 am

Re: MySQL?

Post by schme16 » Sun Apr 17, 2011 3:55 am

despite the 'keep it simple' attitude thats forming in the comments here, I still think its a great idea to have SQL available to use; Mind you, I use JSON to save my tables and such
My Development Diary - http://shanegadsby.info

Post Reply

Who is online

Users browsing this forum: No registered users and 102 guests