Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Mob, Room, Zone lookup

Mob, Room, Zone lookup

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Fletchling   Australia  (54 posts)  Bio
Date Fri 22 Dec 2006 09:01 PM (UTC)
Message
Nick, and assorted Mush Gurus,

I'm about to start a project that builds a table of 8 columns, including mob names, room names, zone name and other related information. The uses are pretty obvious and varied for playing. Ultimately the table will have about 28k records or so.

The things I want to do in general include;

1. Populate the db with info from the mud,
2. Manually populate the db via an alias,
3. Update records via an alias and triggers,
4. Perform lookups of some fields based on the content of one or more other fields,
5. Delete records via an alias,
6. lots of other similar....

Viable spproaches I can think of so far include;
1. Tables of tables,
2. CSV text file,
3. ODBC connection to Access or MYSQL.


I'm using 3.82 (about to upgrade to latest version after backup) and Lua. I have legitimate access to all MS products. My question is which approach I should take that doesn't lead me into a dead end or slow performance. Any links to previous forum posts and guidance/tips appreciated.

Thanks.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 23 Dec 2006 08:10 PM (UTC)
Message
For a comparatively small database a Lua table should work fine, and be very fast. Your only main issue would be to save it from time to time, something you wouldn't need to do with a database.

However I think it would save pretty quickly, and you could either save every time you make a change, or on a timer that fires every couple of minutes.

Lookups should be very fast, and if performance is an issue, which I doubt, you can make lookup tables. That is, for any given table one field can be the key (eg. room vnum). You could make a second table which keys exits (eg. to find which rooms lead to another room).

However a linear search may well be fast enough.

As an example I loaded up my file of rooms used for a recent post about pathing. This consists of 1549 rooms, their descriptions and exits.

I then did a linear scan (that is, examined every entry) looking for the word "Dairy" in the room name with string.match.

The whole process, including loading the 127 Kb rooms file, and scanning each room, happened so fast it was hard to measure, but was certainly under 1 second.

Thus I think you will find that Lua tables will give good performance, and be flexible enough to allow looking at the data in any way you want.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fletchling   Australia  (54 posts)  Bio
Date Reply #2 on Mon 25 Dec 2006 10:01 AM (UTC)
Message
Thanks for the advice Nick.

Lua tables need to be serialised to save between sessions?
If so, is there a maximum size for serialising, bearing in mind the 28,000 records ultimately?
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


11,133 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.