mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-11 12:42:31 +00:00
Add optional Lua scripting capabilties - kannibalox@gmail.com
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#ifndef RTORRENT_LUA_H
|
||||
#define RTORRENT_LUA_H
|
||||
|
||||
#include "rpc/command.h"
|
||||
#include <torrent/object.h>
|
||||
|
||||
#ifdef HAVE_LUA
|
||||
#include <lua.hpp>
|
||||
#endif
|
||||
|
||||
namespace rpc {
|
||||
|
||||
class LuaEngine {
|
||||
public:
|
||||
static const int flag_string = 0x1;
|
||||
static const std::string module_name;
|
||||
|
||||
LuaEngine();
|
||||
~LuaEngine();
|
||||
#ifdef HAVE_LUA
|
||||
// lua_CFunctions
|
||||
static int lua_init_module(lua_State* l_state);
|
||||
static int lua_rtorrent_call(lua_State* l_state);
|
||||
void set_package_preload();
|
||||
lua_State* state() { return m_luaState; }
|
||||
|
||||
private:
|
||||
static std::string search_lua_path(lua_State* l_state);
|
||||
lua_State* m_luaState;
|
||||
#endif
|
||||
};
|
||||
torrent::Object execute_lua(LuaEngine* engine, rpc::target_type target, const torrent::Object& raw_args, int flags);
|
||||
|
||||
#ifdef HAVE_LUA
|
||||
int rtorrent_call(lua_State* l_state);
|
||||
void init_rtorrent_module(lua_State* l_state);
|
||||
void object_to_lua(lua_State* l_state, torrent::Object const& object);
|
||||
void check_lua_status(lua_State* l_state, int status);
|
||||
torrent::Object lua_to_object(lua_State* l_state);
|
||||
torrent::Object lua_callstack_to_object(lua_State* l_state, int command_flags, rpc::target_type* target);
|
||||
#endif
|
||||
|
||||
} // namespace rpc
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user