Macro samp_sdk::define_native [] [src]

macro_rules! define_native {
    ($name:ident as raw) => { ... };
    ($name:ident) => { ... };
    ($name:ident, $( $arg:ident : $( $data:ident )+ ),* ) => { ... };
}

Define native and hide raw C export functions.

Examples

Define a native with raw params (*mut Cell).

// native: WithRawParams(&arg1, arg2, arg3);
define_native!(with_raw_params as raw);

fn with_raw_params(&self, amx: &AMX, args: *mut Cell) -> AmxResult<Cell>;

Define a native without arguments.

// native: WithoutArguments();
define_native!(without_arguments);

fn without_arguments(&self, amx: &AMX) -> AmxResult<Cell>;

Define a native with converted arguments.

// native: SomeFunction(&int_val, float_val);
define_native!(some_function, int_val: ref i32, float_val: f32);

fn some_function(&self, amx: &AMX, int_val: &mut i32, float_val: f32) -> AmxResult<Cell>;