2021-05-19, 11:26 AM
2021-05-18: CALL@
Technically this is a fact about amx-assembly, but it directly affects using YSI.
You saw in the previous tip how using using callback and using function take the parameter specifier after the function name (using function Response<iiiis>).? This is so that the underlying call to addressof can generate the correct code to actually GET the address.? Roughly speaking, a call to the function is generated, but the call is conditional on the result of a call to an internal addressof function, which always returns false.? This is so the internal function can read the next CALL OpCode, but never execute it.? Something like the following:
Becomes:
However, you can customise how addressof internally calls your function using CALL@Name:
Now, addressof doesn?t need the explicit specifier, and by extension neither does using:
However, <iiiis> has the advantage that it is always const-correct, unlike that example?
Technically this is a fact about amx-assembly, but it directly affects using YSI.
You saw in the previous tip how using using callback and using function take the parameter specifier after the function name (using function Response<iiiis>).? This is so that the underlying call to addressof can generate the correct code to actually GET the address.? Roughly speaking, a call to the function is generated, but the call is conditional on the result of a call to an internal addressof function, which always returns false.? This is so the internal function can read the next CALL OpCode, but never execute it.? Something like the following:
Quote:
new a = addressof (MyFunction<iiss>);
Becomes:
Quote:
new a = (GetNextCall() ? MyFunction(INT, INT, STRING, STRING) : gGetNextCallResult);
However, you can customise how addressof internally calls your function using CALL@Name:
Quote:
MyFunction(a, b, const string:c[] = "", const string:d[] = "hello")
{
}
#define CALL@MyFunction MyFunction(4, 5)
Now, addressof doesn?t need the explicit specifier, and by extension neither does using:
Quote:
Response(playerid, dialogid, response, listitem, string:inputtext[])
{
}
#define CALL@Response Response(0, 0, 0, 0, "")
main()
{
____Dialog_ShowCallback(playerid, using function Response, DIALOG_STYLE_INPUT, "Title", "Contents", "OK");
}
However, <iiiis> has the advantage that it is always const-correct, unlike that example?