#pragma once
#include "sol/sol.hpp"

namespace module
{
	/// <summary>
	/// 模块继承接口
	/// </summary>
	class base {
	public:
		virtual ~base() {};
		/// <summary>
		/// 注册全局变量(global类管理)
		/// </summary>
		/// <param name="name"></param>
		/// <param name="lua"></param>
		virtual void regist_global(const char* name, sol::state* lua) = 0;
		/// <summary>
		/// 释放全局变量(global类管理)
		/// </summary>
		virtual void delete_global() = 0;
		/// <summary>
		/// 全局变量阶段获取自身指针 
		/// </summary>
		/// <returns></returns> 
		virtual void* self() { return this; }
		virtual int64_t self_ptr() { return (int64_t)this; }
		/// <summary>
		/// 释放自身(非指针释放，非lua引用释放，仅释放内部资源)
		/// </summary>
		virtual void self_free() {};
	};
}


