Like I said, the environment is a standalone environment only used by the addon, it has no effect to the global environment. Loading a file would run it as a function, change the function's environment will only affect it's content
Lua Code:
And also an addon can have multi-modules, so each module can handle system event for their own. This won't set a meta-table to the global environment, the real job is like : Lua Code:
Also _M:RegisterEvent(xxx, handler) can be used by those moduels. the reason use attribute is it can combine several information : Lua Code:
|
Quote:
定义类型是相对过程式编程较为复杂的问题,这点对于普通插件作者来说,的确是很难接受的,因为意味着思维方式的变化,OOP更容易被现实中有对应经验的人接受,所以对PLoop的态度一般是两极分化的。但我一开始也说明,Scorpio这个框架不需要作者去熟悉PLoop。这个框架主体思路是提供便利和固化的开发方式,而并非要求你自己去学习如何制作类型。 如果要进一步说明,为什么我要在wow里面使用PLoop,而不是更轻量级的系统,更多原因是它很全面,基于它我能更快速的组建上层应用框架。但重申一句,我推荐给普通作者的是Scorpio,而非PLoop,即便在现实生活的工作中,我提供给其他人的也会是上层框架的应用,而不会让他们过多接触底层的东西。 |
All times are GMT -6. The time now is 04:43 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI