#ifndef _H_SCRIPT_H
#define _H_SCRIPT_H

#define SOL_ALL_SAFETIES_ON 1

#include <sol/sol.hpp>
#include <chrono>
#include <memory>

class Script {
public:
	sol::state lua;
	Script(const std::string& path);
	virtual ~Script() {};
private:
	bool loadScript(const std::string& path) {
		auto result = lua.script_file(path);
		if (!result.valid())
		{
			sol::error err = result;
			std::cerr << "Failed to load script ( " << path << " ) Error: " << err.what() << std::endl;
		}
		return result.valid();
	}
	void registerGlobalUserTypes();
};

class AIScript : public Script {
public:
	AIScript(const std::string& path) : Script(path) { registerUserTypes(); }

private:

	void registerUserTypes() ;
};

class WeaponScript : public Script {
public:
	WeaponScript(const std::string& path) : Script(path) { registerUserTypes(); }
private:
	void registerUserTypes() ;
};

#endif // _H_SCRIPT_H