summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/environment.h
blob: ab6cf8c8d28d140b9c7db5e1c5927f3acd06ab97 (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
34
35
#pragma once

class CMLuaEnvironment : public CMPluginBase
{
private:
	CMPluginBase *m_plugin;

	std::map<HANDLE, int> m_hookRefs;
	std::map<HANDLE, int> m_serviceRefs;

protected:
	void CreateEnvironmentTable();

	wchar_t* Error();

public:
	lua_State *L;

	CMLuaEnvironment(lua_State *L);

	int Unload() override;

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

	HANDLE HookEvent(const char *name, int ref);
	int UnhookEvent(HANDLE hHook);

	HANDLE CreateServiceFunction(const char *name, int ref);
	void DestroyServiceFunction(HANDLE hService);

	wchar_t* Call();
	wchar_t* Eval(const wchar_t *script);
	wchar_t* Exec(const wchar_t *path);
};