lua as a database?

Started by
4 comments, last by the_edd 16 years, 6 months ago
Im not sure how to correctly (properly?) implement this, but I have (in C# code, in a console (text based) MUD like app) a loooooong list of what I call "entities" (NPCs, weapons, terrain info etc...). Im thinking it would be better to have this list in an external Lua script. ( I <3 Lua ) How else could this be done?
Advertisement
I'm assuming you mean instances of entities, not their class definitions.

put them in an actual database. it'd be much cleaner and more robust than a hacked together lua script.

-me
"I'm assuming you mean instances of entities, not their class definitions."

The actual data, similar to the following :

weapon1name=axe
weapon1damage=2
weapon1speed=4

weapon2name=sword
weapon2damage=1
weapon2speed=7

etc.....

Probably a horrid way to do it, but hey its what occured to me 1st and I havent seen any better way yet. It works, similar to chopping down a tree with a sledgehammer.

"put them in an actual database" - you mean like using MySQL? Interesting...
Quote:Original post by ididntdoit
"put them in an actual database" - you mean like using MySQL? Interesting...


heh. yes. unsurprisingly, the best answer to "what should I use as my database" is "a database" [smile]

Especially given the generic-ness of your data, a database is perfect. Robustness and ease of use aside you get other benefits. Like being able to trivially write a little PHP page or C# app or whatever to enter new items into your database.

-me
K, its going to feel weird using SQL in a game but hey, if it works nicely Im all for it.

/now to put brushing up on SQL on my call stack....

(this issue is resolved)
Have a look at SQLite. It's much more lightweight than something like MySQL. I'm sure someone must have created bindings for C#, by now.

This topic is closed to new replies.

Advertisement