40 lines
1.0 KiB
Rust
40 lines
1.0 KiB
Rust
use crate::os::platform;
|
|
use rhai::{plugin::*, Engine};
|
|
|
|
#[export_module]
|
|
pub mod platform_functions {
|
|
#[rhai_fn(name = "platform_is_osx")]
|
|
pub fn is_osx() -> bool {
|
|
platform::is_osx()
|
|
}
|
|
|
|
#[rhai_fn(name = "platform_is_linux")]
|
|
pub fn is_linux() -> bool {
|
|
platform::is_linux()
|
|
}
|
|
|
|
#[rhai_fn(name = "platform_is_arm")]
|
|
pub fn is_arm() -> bool {
|
|
platform::is_arm()
|
|
}
|
|
|
|
#[rhai_fn(name = "platform_is_x86")]
|
|
pub fn is_x86() -> bool {
|
|
platform::is_x86()
|
|
}
|
|
|
|
#[rhai_fn(name = "platform_check_linux_x86")]
|
|
pub fn check_linux_x86() -> Result<(), crate::rhai::error::SalError> {
|
|
platform::check_linux_x86()
|
|
}
|
|
|
|
#[rhai_fn(name = "platform_check_macos_arm")]
|
|
pub fn check_macos_arm() -> Result<(), crate::rhai::error::SalError> {
|
|
platform::check_macos_arm()
|
|
}
|
|
}
|
|
|
|
pub fn register(engine: &mut Engine) {
|
|
let platform_module = exported_module!(platform_functions);
|
|
engine.register_global_module(platform_module.into());
|
|
} |