Macro byond::byond
[−]
[src]
macro_rules! byond { ( $n:ident ; $c:block ) => { ... }; ( $n:ident : $( $p:ident ),* ; $c:block ) => { ... }; }
Define a function that BYOND can call into.
The list of arguments is always &str
, and the code block must return an &str
.
If you want finer control over the arguments and return value,
consider using from_byond_args
and return_to_byond()
directly.
Examples
#[macro_use] extern crate byond; // Define a function called "test", taking two arguments. byond!(thing: one, two; { format!("{} + {}", one, two) }); // Get off my back rustdoc. fn main(){}
The above code can be called with the following DM code:
// Produces "a + b" without quotes.
world.log << call("test.dll", "thing")("a", "b")
Panics
Panics if the amount of arguments supplied by BYOND is too small. Note that extra arguments are ignored. Also panics if a NUL byte is attempted to be returned.