|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Sat Jan 06, 2007 6:41 pm
[1.24] %vartype and #showdb #forall Errors |
If you create a string list and convert it to a database record type either via %vartype or the GUI #showdb still expands it as if it were a string list, and #forall still treats it as a string list.
An example.
Open cMud and hit escape to get a blank session.
Create your string list.
#var list "key1=1|key2=2|key3=3"
Use #Forall to view the contents.
#forall list {#show %i}
results
key1=1
key2=2
key3=3
Set the variable type to database.
#call %vartype("@list",5)
Use #showdb to view the contents.
#showdb @list
results
key1=1|key2=2|key3=3:
#Forall still treats it as a string list as well. In fact the only thing that does appear to treat it as a database variable is the GUI display.
If you set the variable to auto type it will display it again as a string list. I know that cMud doesn't store variables the same way Zmud did so the pipe character is not being used to store the database records.
But I think in this case if you set a database record to string type the char should be automatically changed to a pipe and if you set a string list to a database type the char should be changed to whatever the new separation char is. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jan 17, 2007 9:02 pm |
Well, that's true. Just calling %vartype doesn't change the data itself. String lists and database variables are stored differently internally. Using %vartype just changes how the variable is treated by the compiler, but doesn't actually convert the data within the variable itself. I'll consider doing the auto-conversion, but I'm always a bit worried about things that change the data stored in your variable "automatically".
|
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Thu Jan 18, 2007 3:36 pm |
I realize that doing an arbitrary replace can cause problems with things stored in the variable. But in this case it was exactly what was expected. If #forall and the like are not supposed to work when you use %vartype to change the variable then a mention in the documentation would be better than fixing this in my opinion.
I just knew that I could change a variable from a database type to a list type on the fly easily in Zmud and could not in cMud. So I tried the %vartype and it did not work either. *shrugs* I can do the conversion another way. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
|
|