IS4Code / PawnPlus

A SA-MP plugin enhancing the capabilities of the Pawn programming language
MIT License
102 stars 17 forks source link

add await for Dynamic and Normal string #49

Closed Se8870 closed 2 years ago

Se8870 commented 2 years ago

it should be added since there is task_get_result_str_s();

IS4Code commented 2 years ago

Good idea! I was planning something like that for the next version. However, it should also follow the naming scheme like the rest of the functions do - task_await_str should store the string into an array, and task_await_str_s should be the function to return String:.

Se8870 commented 2 years ago

Good idea! I was planning something like that for the next version. However, it should also follow the naming scheme like the rest of the functions do - task_await_str should store the string into an array, and task_await_str_s should be the function to return String:.

So, it should become this:

new result[size];
await_str(result) AnyTaskFunction();
new String:str = await_str_s AnyTaskFunction();

to follow the naming scheme?.

But i think it should be like this:

new result[size], String:str;
await_str(result) AnyTaskFunction();
await_str_s(str) AnyTaskFunction();

Why? it's because normal string macro is await_str(result) and not await_str. So it became much sense if we can treat it same as the normal string.

How do you think about it @IllidanS4?

IS4Code commented 2 years ago

No no, the reason for the (result) argument is simply that you cannot return an array from a function without lots of issues that go with it. But obtaining a single-cell value doesn't have to go through all this hassle and so await_str_s should correspond to simple await and await_var.

Se8870 commented 2 years ago

Oh i see, okay i'll change it.

Se8870 commented 2 years ago

Ok, it's done! 😄