summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/mlua_script.h
blob: 2abb2d215a73dcd4f9f04ed58efabc748ca9001d (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
36
37
38
39
40
41
42
43
44
45
46
#ifndef _LUA_SCRIPT_H_
#define _LUA_SCRIPT_H_

class CMLuaScript
{
public:
	lua_State *L;

	enum Status
	{
		None,
		Loaded,
		Failed
	};

private:
	int id;
	int unloadRef;
	char *moduleName;
	TCHAR *fileName;
	TCHAR filePath[MAX_PATH];
	Status status;

	static bool GetEnviroment(lua_State *L);

public:
	CMLuaScript(lua_State *L, const TCHAR *path);
	~CMLuaScript();

	static CMLuaScript* GetScriptFromEnviroment(lua_State *L);
	static int GetScriptIdFromEnviroment(lua_State *L);

	int GetId() const;

	const char* GetModuleName() const;

	const TCHAR* GetFilePath() const;
	const TCHAR* GetFileName() const;

	const Status GetStatus() const;

	bool Load();
	void Unload();
};

#endif //_LUA_SCRIPT_H_