* Plugin system is in place, allowing you to add features to LibreSplit.
> [!IMPORTANT]
> Always make sure that you fully trust the plugins you're installing.
> Unknown plugins might contain malicious code and give you lots of headaches.
## How do I install a plugin?
Just drop the plugin (which should have a `.so` extension) in your `$XDG_DATA_HOME/libresplit/plugins/` directory (usually will be `~/.local/share/libresplit/plugins/`) and the plugin will be loaded on LibreSplit's next start.
To remove a plugin, just move it out of the `plugins` directory or delete it.
## Plugin Development
Plugins (so far) are enabled to:
- Register new Lua functions;
- Register handlers to timer events.
### The plugin metadata
Each plugin must have the following metadata to identify itself:
* name
* description
* version
* author
You can just stick them in your plugin code like this:
```c
const char plugin_name[] = "Test Plugin";
const char plugin_description[] = "Does nothing, it just exists";
const char plugin_version[] = "0.1";
const char plugin_author[] = "The LibreSplit Core Team";
```
### Initializing the plugin
Each plugin must have an entry point with the following signature:
```c
int plug_init(PlugAPI* api)
```
You can find `PlugAPI` in the `plugin.h` header file, as the plugin system is now, you'll need it to be able to register hooks and Lua functions.
In the init function you will have to register your hooks and Lua functions.
### Registering a new Lua function
Plugins can register new Lua functions. Such functions need to have a signature similar to this:
```c
int my_awesome_lua_function(lua_State* L)
```
You will need to register the function in the `plug_init` entry point, like follows: