- Decoratos are some special kinds of declarations whose change the structure of a function. The list of available decorators is below. There are 2 types of decorators - code block modifiers and statement modifiers.
- Code block modifiers are decorators that decorate a certain code block. They're prefixed with
@.
- Used to make a hook function.
@hook
void MyTestFunc() public
{
}- Used to make a function method.
@method
void MyTestFunc() public
{
}
console.println.MyTestFunc(...)- Used to make a timer.
@task
void mytask() public
{
console.println("Task works!")
}- Statement modifiers are decorators that decorate a certain line of code - or a statement. They're contained within square brackets.
- Check the return documentation.
- Check the quiet function call documentation.
- This keyword is used for modifying decorator parameter values, without a specific order.
@task
this->interval=1000
void mytask() public
{
console.println("Task works!")
}Note that this is NOT possible:
this->interval=1000; // `this` is modifying the arguments of last used decorator
@task
void mytask() public
{
console.println("Task works!")
}- How much does it take till the timer is (re)called.
@task
this->interval=1000
void mytask() public
{
console.println("Task works!")
}NOTE: This parameter's default value is 0, so it is obligatory to set it before creating the task unless you want to rape your logs.
- Will the timer recall after being called once?
@task
this->interval=1000
this->repeat=false
void mytask() public
{
console.println("Task works!")
}NOTE: Now the timer will be called only once 1 second after main external-structured function gets called. Default value of this parameter is true so you don't need to set it unless you want to create a non-repeating timer.