/******************************************************************************
*	File		-	script_manager.h
*	Author		-	Joey Pollack
*	Date		-	2021/08/30 (y/m/d)
*	Mod Date	-	2021/09/02 (y/m/d)
*	Description	-	Manage the main LUA state, Run given scripts and check for
*                   errors. Report errors in the debug log. Also keep a 
*                   history of errors that can be queried.
******************************************************************************/

#ifndef SCRIPT_MANAGER_H_
#define SCRIPT_MANAGER_H_

#include <sol/sol.hpp>
#include <utils/op_res.h>

namespace lunarium
{
    class ScriptManager
    {
    public:
        static ScriptManager& GetInstance();
        static void FreeInstance();

        OpRes Initialize();
        static OpRes RunScript(const char* code);
    
    private:
        static ScriptManager* mpInstance;
        sol::state mState;
        uint32_t mCat;

        friend class CoreAPI;
    };
}

#endif  // SCRIPT_MANAGER_H_