#[init]Expand description
Decorates the entrypoint function of a plugin.
§Usage
This attribute has following 3 argument: platform, name and version.
§Platform
The Social Platform this plugin is for.
As there can only be one plugin active for each Social Platform, this value is used to determine which plugin to use.
A complete list of names can be found here: https://wiki.openttd.org/en/Development/Social%20Integration Please use names from that list, including capitalization.
If you create a plugin for a new Social Platform, please add it to the wiki page.
§Return value for the function
Returning Ok(Some(...)) means the plugin initialized successfully.
Returning Ok(None) means the Social Platform is not running.
Returning Err(()) means the plugin failed to initialize (generic error).
§Examples
use openttd_social_integration_api::{PluginApi, OpenTTDInfo};
#[openttd_social_integration_api_macros::init(platform = "test", name = "Test Plugin", version = "0.1")]
pub fn init(info: OpenTTDInfo) -> Result<Option<PluginApi>, ()> {
Ok(Some(PluginApi {
shutdown: None,
run_callbacks: None,
event_enter_main_menu: None,
event_enter_scenario_editor: None,
event_enter_singleplayer: None,
event_enter_multiplayer: None,
event_joining_multiplayer: None
}))
}