Thread: [Solved] Correct way to do this?
View Single Post
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-20-2018 , 21:46   Re: Correct way to do this?
Reply With Quote #7

Quote:
Originally Posted by redivcram View Post
@Bugsy && Fysiks

At first, I thought charsmax() was the same as sizeof() - 1, that's what everyone said until I found


Although, it gave me an index out of bounds error when I used sizeof(). So I suppose using sizeof() - 1 instead of charsmax().
The point is that the first dimension of gSChars is used as an array, not a string. The second dimension is used as strings. So, the two proper uses would be like this:

Code:
new size_of_array = sizeof gSChars // Gets the size of the first dimension
new max_characters_in_string = charsmax(gSChars[]) // gets the maximum characters of the strings in the array
As I said in my post, your code technically worked because charsmax is the same as sizeof -1 but it's confusing code. Making your code less confusing now will help you when you forget about the plugin and you come back to it later (and for when you ask for help). I have to work with poor coding all the time at work and things like this makes life more frustrating.
__________________
fysiks is offline