summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/mlua_environment.h
blob: aa6ebb103a0b86c343b5dfabc86d42ab995c97bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef _LUA_ENVIRONMENT_H_
#define _LUA_ENVIRONMENT_H_

class CMLuaEnvironment
{
private:
	int m_id;
	std::map<HANDLE, int> m_hookRefs;
	std::map<HANDLE, int> m_serviceRefs;

	void CreateEnvironmentTable();

public:
	lua_State *L;

	CMLuaEnvironment(lua_State *L);
	virtual ~CMLuaEnvironment();

	static CMLuaEnvironment* GetEnvironment(lua_State *L);
	static int GetEnvironmentId(lua_State *L);

	int GetId() const;

	void AddHookRef(HANDLE h, int ref);
	void ReleaseHookRef(HANDLE h);

	void AddServiceRef(HANDLE h, int ref);
	void ReleaseServiceRef(HANDLE h);

	bool Load();
};

#endif //_LUA_ENVIRONMENT_H_