Crates.io | byond_fn |
lib.rs | byond_fn |
version | 0.5.1 |
source | src |
created_at | 2023-05-12 11:48:08.486928 |
updated_at | 2023-05-14 11:15:57.419906 |
description | A utility macro for generating FFI functions for BYOND |
homepage | |
repository | https://github.com/actioninja/byond_fn |
max_upload_size | |
id | 862914 |
size | 36,506 |
A macro crate for defining functions callable from BYOND easily and ergonomically
Basic usage is as simple as:
use byond_fn::byond_fn;
#[byond_fn]
pub fn add(arg1: u8, arg2: u8) -> u8 {
arg1 + arg2
}
This will generate a extern "C" function called add
that can be called from BYOND:
call_ext("example_name.dll", "add")("2", "2") // returns 4
If a parameter is an Option
, it will be optional to call from BYOND.
All optional parameters must be at the end of the parameter list.