Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
hpoonis2010
Adept


Joined: 18 Jun 2019
Posts: 279

PostPosted: Tue May 12, 2020 8:45 pm   

Arrays
 
I am going to assume (quite logically) that arrays index themselves from 0 as in almost all computer langauges.

This is from the documentation:

arrget

Code:
Syntax: %arrget(arrayname,index)

 Return an element from an array. This is like arrayname[index] in other languages. If you ask for an element that is not in the array, a null string is returned. Index values start at ZERO.

 Examples:

#VAR a %array(1,"test","hello")
#SHOW %arrget(a,2)

 displays:

test


Alas, the output is actually 'hello' not 'test'.

However, sometimes I see nothing and sometimes I see the word. Not sure what is happening there.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4671
Location: Pensacola, FL, USA

PostPosted: Wed May 13, 2020 1:55 am   
 
I would assume you are correct.

0=1
1="test"
2="hello"

It seems like a typo in the documentation, nice catch.
_________________
Discord: Shalimarwildcat
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
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

© 2009 Zugg Software. Hosted by Wolfpaw.net