Quote:
Originally Posted by Vergil333
Sooooooooooooooo... What is happening here?
1) setAnInt(50) from second plugin is actually a function. Function from first plugin called native_setAnInt.
2) it pass the value 50 via uselessnatives.inc
3) uselessnatives.inc communicate with CreateNative("setAnInt", native_setAnInt) from first plugin
4) and by this magic, 50 is set in native_setAnInt function in first plugin. This function than changes value of anInt = 50.
That's setAnInt. Passing data from second plugin to the first plugin.
After it is set (passed) it is called by a function getAnInt. And there is no need for magic? It is just called like this? Directly?
I need to pass an array from first plugin to second. Only one-way. What do I need???
|
Here is what actually happens:
A) CreateNative tells SourceMod to bind setAnInt native to plugin function native_setAnInt through FakeNatives.
B) 2nd Plugin calls setAnInt and pushes 50 to param stack.
C) Sourcepawn lookups the native binding of setAnInt, discovers it as a fake native and calls the fake native router associated with the native.
D) SourceMod sets up internal variables related to the fake native it's currently executing (in this case, setAnInt).
E) SourceMod calls the bound plugin function.
F) First plugin does logic for native and returns 0 (because SP compiler code injection).
G) SourceMod re-returns 0 back to SP.
H) SP re-returns 0 back to the 2nd plugin.
I) Second plugin discards the returned value after current function is done executing.