lotus_script/
module.rs

1fn on_negative_to_none(index: i32) -> Option<i32> {
2    match index {
3        -1 => None,
4        i => Some(i),
5    }
6}
7
8/// Returns the index of the cockpit index of the module slot on which this module is set.
9/// None if this script is not running for a module.
10pub fn module_slot_cockpit_index() -> Option<i32> {
11    on_negative_to_none(unsafe { lotus_script_sys::env::module_slot_cockpit_index() })
12}
13
14/// Returns the index of the module slot in the class group of the module slot on which this module is set.
15/// None if this script is not running for a module.
16pub fn module_slot_index_in_class_group() -> Option<i32> {
17    on_negative_to_none(unsafe { lotus_script_sys::env::module_slot_index_in_class_group() })
18}
19
20/// Returns the index of the module slot on which this module is set.
21/// None if this script is not running for a module.
22pub fn module_slot_index() -> Option<i32> {
23    on_negative_to_none(unsafe { lotus_script_sys::env::module_slot_index() })
24}