[Include] inline-timers: Use y_inline functions with timers!
#1

inline-timers




This include allows you to use inline functions as callbacks for timers, similiar to inline dialog callbacks and inline MySQL callbacks.

There is no support for passing extra arguments through this, because the variables (and arguments) in the parent function are accessible in the inline function as well due to a feature called “closuers”, thus rendering the usage of the extra arguments useless. This is however a feature of YSI itself and it has nothing to do with this include.

Installation


Simply install to your project:

Code:
sampctl package install ltkarim/inline-timers
GitHub: https://github.com/ltkarim/inline-timers


Include in your code and begin using the library:

PHP Code:
#include <inline-timers> 

Usage


Example:

PHP Code:
new 
    
someInt 1337,
    
someStr[] = "hello world",
    
FloatsomeFloat 1.337
;
inline TimerTest()
{
    
printf(" TimerTest called after 3 seconds! %i %s %0.3f"someIntsomeStrsomeFloat);
}
SetInlineTimer(using inline TimerTest3000false); 
Outputs:

Code:
TimerTest called! 1337, hello world, 1.337
Dependencies

  • YSI
    • y_malloc
    • y_inline
Testing


To test, simply run the package:

Code:
sampctl package run
Credits

Reply


Messages In This Thread
inline-timers: Use y_inline functions with timers! - by iKarim - 27.03.2018, 14:10
Re: inline-timers: Use y_inline functions with timers! - by NelsonC - 27.03.2018, 14:13
Re: inline-timers: Use y_inline functions with timers! - by iKarim - 20.04.2018, 19:23
Re: inline-timers: Use y_inline functions with timers! - by Pottus - 21.04.2018, 04:42
Re: inline-timers: Use y_inline functions with timers! - by Fairuz - 21.04.2018, 06:35
Re: inline-timers: Use y_inline functions with timers! - by iKarim - 21.04.2018, 07:16

Forum Jump:


Users browsing this thread: 1 Guest(s)