summaryrefslogtreecommitdiff
path: root/Source/3rdParty/Luax/luax_context.cpp
blob: c0fb2f52262e1fec611fea5d23e4927026ef2ff0 (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
#include "luax_context.h"

namespace Luax
{

	// ˴˺
	int l_Errfunc(lua_State* L)
	{
		cc8* err = lua_tostring(L, lua_upvalueindex(1));
		return luaL_error(L, err);
	}

	Context::Context(lua_State* L)
		: state(L)
	{
		assert(state);
	}

	Context::~Context()
	{
	}

	// ʼcontext 
	void Context::Setup()
	{
		SetupRefTables();
	}

	void Context::SetupRefTables()
	{
		// strong ref weak ref
		strongRefTable.Init(state, "LUAX_STRONGREF_TABLE");
		weakRefTable.Init(state, "LUAX_WEAKREF_TABLE", "v");
	}

}