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

CMLua::CMLua() : L(nullptr)
{
}

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

	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);
}