//
// Created by m on 12/12/21.
//

#ifndef RLA_IIPP_LUACONTEXTMANAGER_HPP
#define RLA_IIPP_LUACONTEXTMANAGER_HPP
#include <sol/sol.hpp>
#include "../resources/resourcemanager.hpp"


class LuaContextManager : public ResourceManager<std::shared_ptr<sol::state>, std::string, std::string> {
public:
    std::shared_ptr<sol::state> get_default_context() {
        return fetch_resource(DEFAULT_CONTEXT_KEY);
    }
    void clear_default_context() {
        clear_resource(DEFAULT_CONTEXT_KEY);
    }
protected:
    std::string get_key(std::string args) override;

    std::shared_ptr<sol::state> load_resource(std::string args) override;
private:
    const std::string DEFAULT_CONTEXT_KEY = "default";
};


#endif //RLA_IIPP_LUACONTEXTMANAGER_HPP
