ID:149260
 
Hrmm, I've got a bit of a problem here, and I don't see what's causing it.

With this set under my client/Command()
client/Command(C as text)
var/list/Clist = text2string(C)
usr << string2text(Clist)
var/C2 = Clist[1]
Clist -= Clist[1]
usr << string2text(Clist)


If I type in:

say This is a test say

Exactly like that with no punctuation at the end, the first usr << string2text(Clist) returns exactly that.
But after I set Clist[1] to C2 and remove it from the list, the second usr << string2text(Clist) returns

say This is a test

This is happening both with deadrons list2text procs in his text handling library, and a custom proc that Foomer provided me with, so I don't think theres anything wrong with those.

Does anyone know what might be causing this?
I'm not sure but the problem might be because the C is a C and not a c in Command.
In response to Strange Kidd
Well, I could have client/Command(donkeywoofbark as text) if I wanted. :) Thanks though. Foomer pointed me to the list/Copy() proc, I think I'll just copy all but the first part of the old list into a new list. Maybe this is some sorta byond bug or something though, I dunno. (Figures I would post a code problem ("mob/M as mob not am mob?") in the bug forum, and a bug problem in the code forum, oops. :)
Zagreus wrote:
Hrmm, I've got a bit of a problem here, and I don't see what's causing it.

With this set under my client/Command()
> client/Command(C as text)
> var/list/Clist = text2string(C)
> usr << string2text(Clist)
> var/C2 = Clist[1]
> Clist -= Clist[1]
> usr << string2text(Clist)
>

If I type in:

say This is a test say

Exactly like that with no punctuation at the end, the first usr << string2text(Clist) returns exactly that.
But after I set Clist[1] to C2 and remove it from the list, the second usr << string2text(Clist) returns

say This is a test

This is happening both with deadrons list2text procs in his text handling library, and a custom proc that Foomer provided me with, so I don't think theres anything wrong with those.

Does anyone know what might be causing this?

This is actually the standard behavior. When you -= something from a list, it removes the last instance of that something from the list: last in, first out. You need to use Clist.Cut(1) to get rid of the first item if there is another instance of that item in the list.
In response to Flick
Thank you very much. :) Not exactly sure who you are, but nice to meet you and stuff, and thanks again.

One thing though, it turned out to be Cut(1,2), not just Cut(1), that would have deleted the entire list.