Game Development Community

Limit on string size?

by Jason McIntosh · in Torque Game Builder · 04/12/2006 (12:44 pm) · 5 replies

Is there a limit on string size in Torque?

I'm using strings to store data, and this can potentially mean very huge strings (>1024 characters). I'm getting a buffer overrun abort during testing, and it appears to be caused by one such string.

If there is a limit, how can I increase the limit?

#1
04/12/2006 (2:32 pm)
Did you enable Unicode? I'm not sure but I think ASCII strings are limited to 1024 chars. Are you sure huge strings are the only way?
#2
04/12/2006 (2:52 pm)
Unless there's an explicit reason that you absolutely need to use strings... this is a very bad idea. String operations are slooooow.

EDIT:

I made the same mistake one time ;) I had to pass lots of data back in a return so I used a string.... Eventually I figured out that I could just make a script Object and set all my data in that then send the object back.
#3
04/12/2006 (4:28 pm)
@Joe: I'm not using the betas, alas. I'm using an alpha since some things broke/changed in the betas that prevent me from using them on this project. Do you know where I can find/change the limit for 1024 byte strings? I'm not sure where to look.

@Chris: I don't think it's a mistake. ;) It's a valid approach that fits with TorqueScript's string-bloated functions, and, so far, performance is not an issue at all. I also use strings to serialize/deserialize saved games. String length is just a buffer, so it's trivial to change.. the problem is that I don't know where to look among all the source code.

Thanks guys! :)
#4
04/12/2006 (4:32 pm)
I'd try core\StringBuffer.cc
#5
04/12/2006 (7:58 pm)
Cool, thanks for the suggestion. :)