This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "src/third/socket.lua" | |
local time_table = {} | |
local function hook_timer(o, key, value) | |
if type(value) == "function" and value ~= "summary" then | |
local function inner( ... ) | |
time_table[key] = time_table[key] or 0.0 | |
print("in function ",key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###lua class设计 | |
* 首先要有super chain, 能够正确无误的调用super方法 | |
* 在create阶段绑定所有的attribute,在create结束后,应该禁用掉一切我外部绑定新attribute的方法,防止别人改掉内省逻辑 | |
* 所有数据成员,应该具有一个初始值设定,对数据对象的生命,应该调用self:define_attribute(key, value, defaultValue) | |
* 对于回收时刻,应该对每一个attribute,变更成初始状态的值 | |
* 应该支持面向接口集合的delegate,以便进行组合 | |
* 应该对对象内置函数和状态位之间的hook来进行状态位的绑定,不给外部改变状态的机会 | |
* 其他优化点 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hook_tb = {} | |
local function hook_index(o, key) | |
print("get", key) | |
if type(o["data"][key]) ~= "table" then | |
return o["data"][key] | |
else |
NewerOlder