From 8d8c4ff1664625e7428d0d31cd798d9321680cb2 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 14 Mar 2019 09:08:07 +0800 Subject: *luax --- Source/3rdParty/Luax/luax.h | 49 +++++---------------------------------------- 1 file changed, 5 insertions(+), 44 deletions(-) (limited to 'Source/3rdParty/Luax/luax.h') diff --git a/Source/3rdParty/Luax/luax.h b/Source/3rdParty/Luax/luax.h index f43fb26..58ea2c8 100644 --- a/Source/3rdParty/Luax/luax.h +++ b/Source/3rdParty/Luax/luax.h @@ -1,52 +1,13 @@ #ifndef __LUAX_H__ #define __LUAX_H__ -// 从moai-core中抽离出来 - -// include lua.hpp before this #include "luax_state.h" -#include "luax_ref.h" -#include "luax_class.h" -#include "luax_module.h" #include "luax_runtime.h" +#include "luax_namespace.h" +#include "luax_ref.h" #include "luax_reftable.h" +#include "luax_class.hpp" +#include "luax_class.inl" +#include "luax_state.inl" -// luax 扩展的lua主要概念有 -// * modules -// * class -// * -/* - -GetClassName -GetClass -New -Extend -GetInterfaceTable - - - -__index -__newIndex -__gc -__mode -__tostring - - - -数据成员不需要允许访问(赋值和得到值),通过函数实现,即__index设置为元表 - -名称空间通过表实现 - -通过upvalue实现调用者的访问,而不需要通过传入self,比如通过BaseClass.Extend("SubClass")访问BaseClass,区分不同的base class, -把BaseClass设为Extend的upvalue,在cfunction通过lua_upvalueindex宏里访问upvalue。 - -之所以能通过.调用函数是因为元表,元表可以给userdata和table作为元表,所以userdata可以调用,但实际上不需要这样。 - -interface table -> member table -member table -> ref table -ref table -> userdata 保存了对每个其他类型的引用和引用计数(用hLuaUserdata作为key),计数是为了debug - -class table 是类型的本体(工厂),有New、Extend、GetClassName方法 - -*/ #endif \ No newline at end of file -- cgit v1.1-26-g67d0