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
➜ Table / Array in Mush
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Tkl1129
Hong Kong (43 posts) Bio
|
| Date
| Fri 08 Jul 2011 02:02 AM (UTC) |
| Message
| Is me again~~~ :D
I'm learning about Array / Table function right now :D..
there are few questions about that. As I learn about that is very powerful, can store many data just like Cmuds database variables (.dbvar), in different format...list inside a list....but...I have few questions about that.
1. I want to manage a large database just like a room_name, room_directions, path of comming, path of leaving, npc's name in this room, room type, area name...zone name...
there were over 10+ tittle and the content of each tittle are strings, may be more than 1 string, many strings....also over 1000+ records...
i. many tittle
ii.long contents of each tittle
iii. over 1000+ records.
in this case, do array still good? I think it can use but very hard to manage...-.-"...in this case do I'm able to look SQL database?
2. If I want make some Global stored record in table, am I able to write it to script file?
3. actually...my question I think is asking for a database table like cmud's DB...XD...any plugin can make this easily?
| | Top |
|
| Posted by
| Twisol
USA (2,257 posts) Bio
|
| Date
| Reply #1 on Fri 08 Jul 2011 02:23 AM (UTC) |
| Message
| Lua tables are both arrays and "databases" rolled into one.
-- Table used as an array
local arr = {"hi", "hmm", "foobar"}
-- Table used as a hash
local hash = {
foo = 42,
bar = 200,
twisol = 1337,
}
-- Table used as both!
local mixed = {
"a", "b", "c",
stuff = 50,
}
Array entries (items in a table with no key =) are automatically given a numeric key, so in mixed above you'd use mixed[3] to get "c", and mixed["stuff"] to get 50.
I'm not sure what you mean in your second question, can you explain? |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | | Top |
|
| Posted by
| Fiendish
USA (2,558 posts) Bio
Global Moderator |
| Date
| Reply #2 on Fri 08 Jul 2011 02:33 AM (UTC) |
| Message
|
Quote: "databases"
I think you mean dictionaries. |
https://github.com/fiendish/aardwolfclientpackage | | Top |
|
| Posted by
| Twisol
USA (2,257 posts) Bio
|
| Date
| Reply #3 on Fri 08 Jul 2011 02:43 AM (UTC) |
| Message
| | Hence the quotes. I was using his term because that's what he's familiar with, and tables are a passable analog to zmud databases anyways. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Fri 08 Jul 2011 03:35 AM (UTC) |
| Message
|
Tkl1129 said:
in this case, do array still good? I think it can use but very hard to manage...-.-"...in this case do I'm able to look SQL database?
1000 records isn't large. 10,000 or 100,000 can easily be handled by tables.
However you can also use SQLite3 databases (that is SQL). There is a lot of support for that in the client, see:
http://mushclient.com/db
http://mushclient.com/sql |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | 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.
24,131 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top