LibreSplit/plugins/test_plugin/test_plugin.c
Penaz 63930640f5 Allow plugins to register custom Lua functions
Will probably need to find a better way to allow plugins to access
internal functions of LibreSplit instead of this "PlugAPI bridge" I've
made
2026-03-13 23:51:29 +01:00

27 lines
663 B
C

#include "lua.h"
#include "plugin.h"
#include "plugin_utils.h"
#include <stdio.h>
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";
int do_something_lua(lua_State* L)
{
if (lua_gettop(L) != 0) {
printf("No arguments, we're still way too early for that");
lua_pushnil(L);
return 1;
}
printf("Hello from a Lua C Function");
lua_pushnumber(L, 1);
return 1;
}
int plug_init(PlugAPI* api)
{
api->register_lua_function("sayHello", do_something_lua);
return 0;
}