惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
Engineering at Meta
Engineering at Meta
Last Week in AI
Last Week in AI
V
Visual Studio Blog
Stack Overflow Blog
Stack Overflow Blog
A
About on SuperTechFans
博客园 - 司徒正美
D
DataBreaches.Net
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
MyScale Blog
MyScale Blog
I
InfoQ
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
月光博客
月光博客
Google DeepMind News
Google DeepMind News
Recent Announcements
Recent Announcements
小众软件
小众软件
G
Google Developers Blog
博客园 - 【当耐特】
U
Unit 42
美团技术团队
B
Blog
D
Docker
Blog — PlanetScale
Blog — PlanetScale

博客园 - SweetDream

如何使用SecureCRT连接ubuntu (转) 转 linux共享 VC++中的char,wchar_t,TCHAR(转载) 【转】Linux内核学习笔记(5)连载---实模式、保护模式和虚拟8086方式 concept 计算机英语 C++备忘录(记录一些不常使用的语法规则) Effective STL 笔记 <容器> VS2005 快捷键 网摘 君心莫邪 迭代器(iterators) 空间配置器(allocator) 函数返回引用或指针的选择 【转】最节省时间的方法——学习 C++数据类型速查 Cegui的事件机制 C++不定参数 Lua 与 C 交互(1)
Lua 与 C 交互(2)
SweetDream · 2008-10-15 · via 博客园 - SweetDream

1.new tbClass{}, Binding "FunName" to C function "thunk" and set it's closure with upvalue;

2.rigister metatable "Class", and set metatable __index to table"tbClass"

3.new pObj, new userdata to point it, and set this userdata's metatable then push it into stack.

4.call Obj:FunName()

5.because Obj associate tbClass by metatable, so will call tbClass[FunName], then call thunk, remember thunk have upvalue.

6.when we have userdata whitch have pObj,and have upvalue,then CallFun

1.new tbClass{},Encapsulation all Class Memeber as KLuaData. tbClass[FunName] = KLuaData.KLuaData push as userdata.

2.rigister metatable "Class", and set metatable __index to C Function "_LuaIndex"

3.push userdata who's restore pObj, and set metatable

4.Call a.FunName()

5.Call C Function _LuaIndex,in this can get pObj and KLuaData,switch kind of KLuaData,execute diff Op.

6.if KLuaData is FunData, then push pObj,and FunData, and CFun "_LuaDispatcher",then () will Call this Fun

7.CallFun