1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-04-01 15:06:43 +00:00
openmw-tes3mp/apps/openmw-mp/Script/API/PublicFnAPI.hpp
Koncord 4ca5da5666 [Server] Rework Plugin API, move Lua system to external library
Use LibFFI for Public & Timer APIs
Use "PlayerId" type instead "unsigned short"
Add GetPluginDir() function
2019-02-12 05:29:57 +08:00

37 lines
859 B
C++

//
// Created by koncord on 14.05.16.
//
#ifndef PLUGINSYSTEM3_PUBLICFNAPI_HPP
#define PLUGINSYSTEM3_PUBLICFNAPI_HPP
#include <unordered_map>
#include <Script/FFI.hpp>
class Public : public FFI
{
private:
~Public();
static std::unordered_map<std::string, Public *> publics;
Public(ScriptFunc _public, const std::string &name, char ret_type, const std::string &def);
std::string def;
char retType;
public:
template<typename... Args>
static void MakePublic(Args &&... args) { new Public(std::forward<Args>(args)...); }
static ffi_arg Call(const std::string &name, va_list args);
static const std::string &GetName();
static const std::string &GetDefinition(const std::string &name);
static char GetReturnType(const std::string &name);
static void DeleteAll();
};
#endif //PLUGINSYSTEM3_PUBLICFNAPI_HPP