summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/lua.cpp
blob: dd2fd6460627356e93b87ced532b0248c7fb81e5 (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
#include "stdafx.h"

CMLua::CMLua() : L(nullptr)
{
	//MUUID muidLast = MIID_LAST;
	//g_hMLuaLangpack = GetPluginLangId(muidLast, 0);
}

CMLua::~CMLua()
{
	Log("Unloading lua engine");

	KillModuleIcons(g_hMLuaLangpack);
	KillModuleSounds(g_hMLuaLangpack);
	KillModuleMenus(g_hMLuaLangpack);
	KillModuleHotkeys(g_hMLuaLangpack);

	KillObjectEventHooks(L);
	KillObjectServices(L);

	lua_close(L);
}

lua_State* CMLua::GetState()
{
	return L;
}

void CMLua::Load()
{
	Log("Loading lua engine");
	L = luaL_newstate();
	Log("Loading standard modules");
	luaL_openlibs(L);

	lua_atpanic(L, luaM_atpanic);
}