TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Array matching

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
ryan0_o



Joined: 01 Mar 2010
Posts: 171

PostPosted: Tue Apr 06, 2010 11:36 pm    Post subject: Array matching Reply with quote

Not sure if this is a user error but these seem to return the opposite of the results they are supposed to.

Code:

#showme $charmlist[]
{captain}{guardian}

#showme $charmlist[%*]
{0}{0}

#showme $charmlist[%w]
{0}{0}




Usually I would just assume you are going to make me feel stupid for posting this, but this time I think I might be right =D
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3844

PostPosted: Tue Apr 06, 2010 11:48 pm    Post subject: Reply with quote

Alas, the %* matches the variables and displays their value.

In this case %w is matching captain and guardian, and displaying their value, which is {0}.
Back to top
View user's profile Send private message Send e-mail
ryan0_o



Joined: 01 Mar 2010
Posts: 171

PostPosted: Wed Apr 07, 2010 1:50 am    Post subject: Reply with quote

Should have followed my instincts! What is the distinction between characters and letters? Characters can be qualified as digits and letters?
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3844

PostPosted: Wed Apr 07, 2010 8:49 am    Post subject: Reply with quote

Digits are sorted as digits, everything else is sorted alphabetically.

If you sort numbers alphabetically you would get:

10 200 3 4000

tintin aranges them as: 3 10 200 4000 to enable associative arrays to be used as arrays as well. As far as I know tt++ is the only scripting language that does this, so it's a bit unusual, but so far it seems to work alright.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group