• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Set the size of an array based on another
#1
Hello, I know that the size of an array must be defined by a constant, but is there any way to define the size based on a parameter or another array?

PHP Code:
stock GetStringPreview(string[],maxlength=25)
{
new 
preview[maxlength+3],len;
format(preview,maxlength,"%s",string);
if(
strlen(string) > maxlength)
{
len strlen(preview);
strins(preview"...",((preview[len-1] == ' ') ? len-len));
}
return 
preview;

  Reply


Messages In This Thread
Set the size of an array based on another - by JR_Junior - 2024-06-07, 01:03 PM

Forum Jump: