From 8644e03586ac9c39741f62cbcbce87b18805538c Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 14 Mar 2019 23:12:54 +0800 Subject: =?UTF-8?q?*=E5=A4=A7=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/3rdParty/Luax/luax_context.cpp | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Source/3rdParty/Luax/luax_context.cpp (limited to 'Source/3rdParty/Luax/luax_context.cpp') diff --git a/Source/3rdParty/Luax/luax_context.cpp b/Source/3rdParty/Luax/luax_context.cpp new file mode 100644 index 0000000..c0fb2f5 --- /dev/null +++ b/Source/3rdParty/Luax/luax_context.cpp @@ -0,0 +1,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"); + } + +} \ No newline at end of file -- cgit v1.1-26-g67d0