#emit
#2

#emit is a way to write in-line P-Code/Bytecode (Pawn's compiled "Assembly" so to speak).

This is often done to either bypass limitations of the language, obsfucate code, increase execution speed (by hand-assembling specific code faster than the compiler would) or all of the above.

In this case I think it is bypassing a limitation of how arguments are managed by the Pawn language, as it seems to be pushing a variable amount of arguments to the stack in that while, which would not be possible by writing it properly.

Quote:

#emit PUSH.S text
#emit PUSH.C 144
#emit PUSH.C str
#emit PUSH.S 8
#emit SYSREQ.C format

In this portion of the code, the parameters "text", "144", "str", and "8" are pushed to the stack to be used as variables, before doing a system call to the sa-mp server to run the "format" function with these.

The Pawn Language Official Document by CompuPhase has a small bit where these preprocessor directives are explained, including #emit

TL-DR: All of those emits are just for a format(), but it cannot be done without emits as it was done this way in order to be able to send a variable amount of arguments
Reply


Messages In This Thread
#emit - by Salint - 24.01.2020, 15:51
Re: #emit - by Markski - 24.01.2020, 20:52
Re: #emit - by Kwarde - 24.01.2020, 21:25
Re: #emit - by Markski - 24.01.2020, 22:36
Re: #emit - by Salint - 25.01.2020, 04:35
Re: #emit - by Calisthenics - 25.01.2020, 07:56

Forum Jump:


Users browsing this thread: 1 Guest(s)