SA-MP Forums Archive
Which? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Which? (/showthread.php?tid=274717)



Which? - Gh0sT_ - 07.08.2011

Which "way" is better?

FOR EXAMPLE:

1.

pawn Код:
new bool: Test = true, TestStr[5 + 1];
    if(Test) valstr(TestStr, 45454);
    else TestStr = "false";
    printf("Test - %s", TestStr);
2.

pawn Код:
new bool: Test = true, TestStr[5 + 1];
    if(Test) format(TestStr, 5, "%d", 45454);
    else TestStr = "false";
    printf("Test - %s", TestStr);



Re: Which? - Grim_ - 07.08.2011

Neither way is really better, just a matter of preference. Using valstr() may be slightly quicker than formatting, but it wouldn't be enough to tell a difference unless you are running the function multiple times, right after another.


Re: Which? - Gh0sT_ - 07.08.2011

Quote:
Originally Posted by Grim_
Посмотреть сообщение
Neither way is really better, just a matter of preference. Using valstr() may be slightly quicker than formatting, but it wouldn't be enough to tell a difference unless you are running the function multiple times, right after another.
So, actually, there's no difference at all? There isn't any other ways AFAIK to do something like this, if true = int, else str.


Re: Which? - Gh0sT_ - 07.08.2011

^^^^^