ID:105953
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
client/New(){
var/string="ABC";
world<<"string is [string] and length(string) is [length(string)]";
string+=ascii2text(0);
world<<"string is [string] and length(string) is [length(string)]";
string+=null;
world<<"string is [string] and length(string) is [length(string)]";
}
/*
Output:
string is ABC and length(string) is 3
string is ABC and length(string) is 3
string is ABC and length(string) is 3
*/



Please add the ability to null terminate a string.


For what purpose
1) Cryptography.
2) Compatibility with C, which is used for custom DLL calls.
3) Because it makes sense.
Airjoe wrote:
1) Cryptography.
I suppose, though there are plenty of other characters you could use

2) Compatibility with C, which is used for custom DLL calls.
Maybe so, though DLLs aren't exactly user friendly on either end, or guaranteed to function since they require permission, and in most cases aren't necessary.

3) Because it makes sense.
It makes sense to have an imaginary non-text character at the end of a string?
Falacy wrote:
I suppose, though there are plenty of other characters you could use

Null is specifically referenced by various algorithms, including one I recently tried to implement in BYOND but couldn't because of this.

Maybe so, though DLLs aren't exactly user friendly on either end, or guaranteed to function since they require permission, and in most cases aren't necessary.

Do you have anything to back that up? If BYOND doesn't implement something, it needs to be implemented through dll. Again, cryptography is a prime example.

It makes sense to have an imaginary non-text character at the end of a string?

Just because it isn't a letter doesn't mean it's a non-text character. It is a part of the ASCII standard and should be supported.
Airjoe wrote:
Do you have anything to back that up?

Call a DLL and see the security popup?

If BYOND doesn't implement something, it needs to be implemented through dll. Again, cryptography is a prime example.

I don't think I've come across anything that wasn't doable in DM. Sounds more like you just want to be lazy and steal somebody else's code, but need null characters to make use of it. Simply determining where the end of a string is is pretty simple...
Falacy wrote:
Call a DLL and see the security popup?

What security popup? Also known as, welcome to the world of Linux servers.

I don't think I've come across anything that wasn't doable in DM. Sounds more like you just want to be lazy and steal somebody else's code, but need null characters to make use of it. Simply determining where the end of a string is is pretty simple...

Sure thing, Falacy. Go ahead and implement SHA-2 or AES in BYOND.

Even for things that can be done in BYOND, offloading to a DLL is orders of magnitude more efficient.
Airjoe wrote:
What security popup? Also known as, welcome to the world of Linux servers.

I've been in that world, it was a horrible horrible place that I hope to never return to
If you need an array of bytes, have you tried using a DM list of numbers? The 1-based indexing will get annoying and it might be slower, but it'll work.

Also, as I suggested in another feature request, use base64 encoding when passing strings between DLLs and DM. Base64 encoding is for exchanging binary data using a safe subset of ASCII.
Strings are already null-terminated. I believe what you're looking for is a way to use an array of raw bytes that may happen to include a 0 byte.
Yes, that is what I'm looking for, sorry for misunderstanding the current implementation.