Attribute Macro define

Source
#[define]
Expand description

Defines a callable lead function

Please read the full documentation
use interpreter::BufValue;
 
#[define((
  desc: "Prints a variable",
  notes: Some("Optional Note"),
  params: [
    // "my-custom-regex, see example below",
    r"\$[a-z0-9_]*" // This is a regex of a lead variable
  ],
  returns: Some("%null"), // %null means that it returns nothing
  usage: [
    (
      desc: "Prints $hello",
      code: "print $hello"
    )
  ]
  root: Some("MyNewRT"), // This is a method on a RuntimeValue
))]
fn foo(var: &BufValue) {
  println!("{}", var.display());
}

§Creating a prototype function

You just need to update the root variable

These special values are :-

§returns field

The standardized values are :-

ValueDescription
%nullReturns Nothing
@rt:nameReturns the RuntimeValue named name
intInt
u_intUInt
FFloat
SString
Bboolean
ArrArray
ObjObject
FaFaillable
*ptrRaw Immutable Pointer
*m ptrRaw Mutable Pointer
JoinHandleAsync Task
ListenerReturns Listener that can be used to listen for events
RtRAWReturns RAWRuntime Values (You shouldn’t return a RawRTValue::PKG and should focus on RuntimeValues ONLY!)