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 »

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 »

You could use luaSQL.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: MySQL?

Post by BlackBulletIV »

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: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: MySQL?

Post by miko »

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 »

yep, it works quite well in fact. i used a profiler library with it too.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: MySQL?

Post by BlackBulletIV »

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 »

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: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: MySQL?

Post by Taehl »

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: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: MySQL?

Post by BlackBulletIV »

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 »

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 42 guests