#pragma once
#include <vector>
#include <string>
#include <lua.hpp>

class ScriptComponent;

class ScriptCore
{
public:
    static void Init();

    static void RegisterState(lua_State* L,
                              const std::string& scriptPath,
                              const std::string& name,
                              ScriptComponent* component);

    static void UnregisterState(lua_State* L);

    static void CallAllInits();
    static void CallAllUpdates(float dt);

    // New features:
    static void ReloadAllScripts();
    static void PrintScriptDiagnostics();

private:
    struct LuaScript
    {
        lua_State* L;
        std::string scriptPath;
        std::string name;
        ScriptComponent* component;
    };

    static inline std::vector<LuaScript> s_LuaStates;
};
