SA-MP Forums Archive
Calling an inline function (y_inline)? - 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)
+--- Thread: Calling an inline function (y_inline)? (/showthread.php?tid=664947)



Calling an inline function (y_inline)? - polygxn - 16.03.2019

Stupid question, but how?

PHP код:
function MainFunction() {
    for (new 
ii<SOME_THINGi++) {
        
//I want to call SomeFunction here
        
SomeFunction(); // Not working
    
}
    
inline SomeFunction() {
        print(
":)");
    }




Re: Calling an inline function (y_inline)? - polygxn - 17.03.2019

Quote:
Originally Posted by ******
Посмотреть сообщение
You can’t quite do that. y_inline assumes that you are always passing the function as a parameter somewhere else. The best you can do is:

Код:
Looper(Func:function<>)
{
    for (new i = 0; i != SOME_THING; ++i)
    {
        @.function();
    }
}

main()
{
    inline SomeFunction()
    {
    }
    Looper(using inline SomeFunction);
}
Oh, okay, thanks! I just want to keep my code way too clean sometimes I do stupid things, but at least I know this is not possible.