SlideShare uma empresa Scribd logo
1 de 10
Baixar para ler offline
lua介绍                                                  页码,1/10




                                                  介
                                               lua介绍
             Author: 罗进 <luojinlj@gmail.com>
             Version: 1


使用lua提高开发效率




议程
   • 缘起
   • lua特点
   • lua语法
   • lua库,c扩展
   • iphone-wax开发介绍
   • 迅雷插件开发介绍
   • wireshark插件开发介绍




file:///C:/lua.htm                                      2011/5/12
lua介绍                            页码,2/10




缘起
   • 工作中使用c++
   • 新产品需求不定
   • 时间浪费在编译、部署、执行上
   • --lua可以在应用程序运行期修改代码


lua特点
   特
   • 目的:嵌入宿主程序执行,只是个核。
   • 快:基于寄存器的虚拟机,与宿主程序在栈上交互
   • 小:164k,可裁剪更小。python2100k
   • 省:自动垃圾收集、弱类型、单一数据结构,扩展c简单
   • 稳定:5.1版2006发布




file:///C:/lua.htm                2011/5/12
lua介绍                                                    页码,3/10




lua语法:与python区别
   语法:与      区
lua
       • local,if then end, for do end,建议2个空格缩进
       • 迭代器少,只有一个tabel数据结构,强大的闭包
       • 继承使用prototype,即metatable中的__index(),用table模拟
       • 文档少,第三方库少,源代码好,与c结合好,调试方便
python
    • global,if :,for :,统一缩进
    • 生成式[d for d in data],listdicttuple...,够用的lambda,
    • 文档多,第三方库多,源代码不好




file:///C:/lua.htm                                        2011/5/12
lua介绍                                                                                        页码,4/10




lua库,c扩展
   库 扩
   • lua for windows:第三方库非官方合集
           • alien:同python的ctypes
           • penlight:自称battery include,借鉴python

   • luarocks:同python的easy_install(PEAK)

   • 自己扩展

       L=luaL_newstate(); luaL_openlibs(L);        //   init
       luaL_dofile("")                             //   readfile and compile
       lua_getglobal(L, func_name)                 //   find func in global table
       lua_pushinteger()                           //   parameter push to stack for called
       lua_pcall(L, narg, nresult, 0)              //   call
       lua_tonumber()                              //   result




file:///C:/lua.htm                                                                            2011/5/12
lua介绍                                    页码,5/10




          开发介
iphone-wax开发介绍
          开发
为什么用lua写iphone
         写
  • objc不如lua好用
  • 轻松垃圾收集(java),非引用计数(python)
  • 更少的代码,你懂得
  • cocoa无缝集成,NSDictionary等的自动转换,自定义控件
  • 更强的HTTP功能
  • 闭包
  • 正则




file:///C:/lua.htm                        2011/5/12
lua介绍                                                                         页码,6/10




      代
iphone代码流
       UIApplication->
           UIAppDelegate->
               applicationDidFinishlaunching()
                   // add controllers for callbacks
                   UITableViewController *tableViewController;
                   UIWindow *window;

                     tableViewController = [[UITableViewController alloc]];

                     [window addSubview:tableViewController.view];
                     [window make key and visible]

       objc class目录:app由多个controller+view组成,含.h .m文件
       lua script目录:appDelegate.lua,viewController.lua




file:///C:/lua.htm                                                             2011/5/12
lua介绍                                                                         页码,7/10




   代
wax代码流 main.m
       wax_start(char *initScript, lua_CFunction extension, ...);
           wax_setup();
               luaopen_wax_class(L);       //lua访问cocoa
                   Finds an ObjC class,    //__index()
                   Creates a new ObjC class//__call()

                     luaopen_wax_instance(L);         //Cocoa 对象
                     luaopen_wax_struct(L);           //cocoa struct

               Load extentions, stdlib                //lua的json、xml、http等库
               luaL_dostring(L, initScript)           //加载用户代码

       wax_startWithServer();                         //交互命令控制显示

       wax_end(); //lua_close(wax_currentLuaState());

   • waxClass{"TwitterTableViewController", UITableViewController}
   • 继承 类 ,            功能 数


迅雷插 开发介
迅雷插件开发介绍 图



file:///C:/lua.htm                                                             2011/5/12
lua介绍                                                                              页码,8/10




迅雷插 开发介
迅雷插件开发介绍
       addin.cfg       //应用的相关信息
       XAR/onload.lua // main()
           function OnMyIconClick(self)
               local tabCtrl = XLGetGlobal("xunlei.UIControlProvider").GetMainWndTab()
               local index = tabCtrl:GetItemPosByTitle("MyApp")

                     tabCtrl:SelectItem(index)
               end

               local addin_mgr = XLGetGlobal("xunlei.AddinManagerHelper")
               addin_mgr.RegisterService("MyApp", "我的应用", "icon", "", OnMyIconClick, nil)

       XAR/layout/Control.xml              //界面
       XAR/layout/Control.cml.lua          //逻辑


         插 开发介
wireshark插件开发介绍 图




file:///C:/lua.htm                                                                  2011/5/12
lua介绍                                                                                                           页码,9/10




         插 开发介
wireshark插件开发介绍
       dofile("myProto.lua") // init.lua, wireshake调用

       local protocal = Proto("myProto","myProto xxx") //新协议
       local field1 = ProtoField.bytes("myProto.identifier","Identifier") //协议字段
       protocal.fields = { field1, ..., }              //协议构造

       function protocal.dissector(buf,pkt,root) //回调:解析协议后,将数据加入指定字段
           local t = root:add(protocal,buf)
           t:add(field1,v_identifier)
           ...
       end


Ref
   • lua http://lua-users.org/wiki/SampleCode
   • internal http://simohayha.iteye.com/category/84720
   • wax https://github.com/probablycorey/wax
   • 迅雷 http://xldoc.xl7.xunlei.com/0000000024/00000000240000700004.html
   • wireshark http://yoursunny.com/study/IS409/ScoreBoard.htm]]
   • S5 http://meyerweb.com/eric/tools/s5/
   • rst http://docutils.sourceforge.net/rst.html
   • rst2s5 http://docutils.sourceforge.net/docs/user/slide-shows.html
   • s5定 http://blog.zoomquiet.org/pyblosxom/utility/py4str/StructuredText/rst2s5-usage-2010-09-18-23-23.html



file:///C:/lua.htm                                                                                               2011/5/12
lua介绍                页码,10/10




FAQ
FAQ




file:///C:/lua.htm    2011/5/12

Mais conteúdo relacionado

Mais procurados

自由軟體鑄造場_20111023_Subversion版本控制系統之操作_曾義峰(ant)
自由軟體鑄造場_20111023_Subversion版本控制系統之操作_曾義峰(ant)自由軟體鑄造場_20111023_Subversion版本控制系統之操作_曾義峰(ant)
自由軟體鑄造場_20111023_Subversion版本控制系統之操作_曾義峰(ant)OpenFoundry
 
啟動 Laravel 與環境設定
啟動 Laravel 與環境設定啟動 Laravel 與環境設定
啟動 Laravel 與環境設定Shengyou Fan
 
Spring 2.0 技術手冊導讀
Spring 2.0 技術手冊導讀Spring 2.0 技術手冊導讀
Spring 2.0 技術手冊導讀Justin Lin
 
Jetty服务器架构及调优.v2 2011-5
Jetty服务器架构及调优.v2 2011-5Jetty服务器架构及调优.v2 2011-5
Jetty服务器架构及调优.v2 2011-5lovingprince58
 
GNU Autoconf / Automake #4
GNU Autoconf / Automake #4GNU Autoconf / Automake #4
GNU Autoconf / Automake #4imacat .
 
COSCUP 2016 Laravel 部署工作坊 - 部署指南
COSCUP 2016 Laravel 部署工作坊 - 部署指南COSCUP 2016 Laravel 部署工作坊 - 部署指南
COSCUP 2016 Laravel 部署工作坊 - 部署指南Shengyou Fan
 
Phpconf 2011 introduction_to_codeigniter
Phpconf 2011 introduction_to_codeigniterPhpconf 2011 introduction_to_codeigniter
Phpconf 2011 introduction_to_codeigniterBo-Yi Wu
 
PHP 語法基礎與物件導向
PHP 語法基礎與物件導向PHP 語法基礎與物件導向
PHP 語法基礎與物件導向Shengyou Fan
 
Openshift by mtchang
Openshift by mtchangOpenshift by mtchang
Openshift by mtchangChang Mt
 
Spring4.x + hibernate4.x_配置详解
Spring4.x + hibernate4.x_配置详解Spring4.x + hibernate4.x_配置详解
Spring4.x + hibernate4.x_配置详解zany_hui
 
lua & ngx_lua 的介绍与应用
lua & ngx_lua 的介绍与应用lua & ngx_lua 的介绍与应用
lua & ngx_lua 的介绍与应用hugo
 
Oracle试题Exam Adminv1.1
Oracle试题Exam Adminv1.1Oracle试题Exam Adminv1.1
Oracle试题Exam Adminv1.1Zianed Hou
 
Mysql展示功能与源码对应
Mysql展示功能与源码对应Mysql展示功能与源码对应
Mysql展示功能与源码对应zhaolinjnu
 
凌波微步:wagon + VS Code 的輕功哲學
凌波微步:wagon + VS Code 的輕功哲學凌波微步:wagon + VS Code 的輕功哲學
凌波微步:wagon + VS Code 的輕功哲學Shengyou Fan
 
前端工程師一定要知道的 Docker 虛擬化容器技巧
前端工程師一定要知道的 Docker 虛擬化容器技巧前端工程師一定要知道的 Docker 虛擬化容器技巧
前端工程師一定要知道的 Docker 虛擬化容器技巧Chu-Siang Lai
 
View 與 Blade 樣板引擎
View 與 Blade 樣板引擎View 與 Blade 樣板引擎
View 與 Blade 樣板引擎Shengyou Fan
 
开源Pass平台flynn功能简介
开源Pass平台flynn功能简介开源Pass平台flynn功能简介
开源Pass平台flynn功能简介Zhichao Liang
 
[Modern Web 2016] 讓你的 PHP 開發流程再次潮起來
[Modern Web 2016] 讓你的 PHP 開發流程再次潮起來[Modern Web 2016] 讓你的 PHP 開發流程再次潮起來
[Modern Web 2016] 讓你的 PHP 開發流程再次潮起來Shengyou Fan
 
1, shell intro
1, shell intro1, shell intro
1, shell introted-xu
 

Mais procurados (20)

自由軟體鑄造場_20111023_Subversion版本控制系統之操作_曾義峰(ant)
自由軟體鑄造場_20111023_Subversion版本控制系統之操作_曾義峰(ant)自由軟體鑄造場_20111023_Subversion版本控制系統之操作_曾義峰(ant)
自由軟體鑄造場_20111023_Subversion版本控制系統之操作_曾義峰(ant)
 
啟動 Laravel 與環境設定
啟動 Laravel 與環境設定啟動 Laravel 與環境設定
啟動 Laravel 與環境設定
 
Spring 2.0 技術手冊導讀
Spring 2.0 技術手冊導讀Spring 2.0 技術手冊導讀
Spring 2.0 技術手冊導讀
 
Jetty服务器架构及调优.v2 2011-5
Jetty服务器架构及调优.v2 2011-5Jetty服务器架构及调优.v2 2011-5
Jetty服务器架构及调优.v2 2011-5
 
GNU Autoconf / Automake #4
GNU Autoconf / Automake #4GNU Autoconf / Automake #4
GNU Autoconf / Automake #4
 
COSCUP 2016 Laravel 部署工作坊 - 部署指南
COSCUP 2016 Laravel 部署工作坊 - 部署指南COSCUP 2016 Laravel 部署工作坊 - 部署指南
COSCUP 2016 Laravel 部署工作坊 - 部署指南
 
Phpconf 2011 introduction_to_codeigniter
Phpconf 2011 introduction_to_codeigniterPhpconf 2011 introduction_to_codeigniter
Phpconf 2011 introduction_to_codeigniter
 
PHP 語法基礎與物件導向
PHP 語法基礎與物件導向PHP 語法基礎與物件導向
PHP 語法基礎與物件導向
 
Openshift by mtchang
Openshift by mtchangOpenshift by mtchang
Openshift by mtchang
 
Spring4.x + hibernate4.x_配置详解
Spring4.x + hibernate4.x_配置详解Spring4.x + hibernate4.x_配置详解
Spring4.x + hibernate4.x_配置详解
 
lua & ngx_lua 的介绍与应用
lua & ngx_lua 的介绍与应用lua & ngx_lua 的介绍与应用
lua & ngx_lua 的介绍与应用
 
Oracle试题Exam Adminv1.1
Oracle试题Exam Adminv1.1Oracle试题Exam Adminv1.1
Oracle试题Exam Adminv1.1
 
Mysql展示功能与源码对应
Mysql展示功能与源码对应Mysql展示功能与源码对应
Mysql展示功能与源码对应
 
Linux chapt3
Linux chapt3Linux chapt3
Linux chapt3
 
凌波微步:wagon + VS Code 的輕功哲學
凌波微步:wagon + VS Code 的輕功哲學凌波微步:wagon + VS Code 的輕功哲學
凌波微步:wagon + VS Code 的輕功哲學
 
前端工程師一定要知道的 Docker 虛擬化容器技巧
前端工程師一定要知道的 Docker 虛擬化容器技巧前端工程師一定要知道的 Docker 虛擬化容器技巧
前端工程師一定要知道的 Docker 虛擬化容器技巧
 
View 與 Blade 樣板引擎
View 與 Blade 樣板引擎View 與 Blade 樣板引擎
View 與 Blade 樣板引擎
 
开源Pass平台flynn功能简介
开源Pass平台flynn功能简介开源Pass平台flynn功能简介
开源Pass平台flynn功能简介
 
[Modern Web 2016] 讓你的 PHP 開發流程再次潮起來
[Modern Web 2016] 讓你的 PHP 開發流程再次潮起來[Modern Web 2016] 讓你的 PHP 開發流程再次潮起來
[Modern Web 2016] 讓你的 PHP 開發流程再次潮起來
 
1, shell intro
1, shell intro1, shell intro
1, shell intro
 

Destaque

How to configure an environment to cross-compile applications for beagleboard-xM
How to configure an environment to cross-compile applications for beagleboard-xMHow to configure an environment to cross-compile applications for beagleboard-xM
How to configure an environment to cross-compile applications for beagleboard-xMDalton Valadares
 
Logging develop
Logging developLogging develop
Logging developgowell
 
The Rise of the Internet of Things
The Rise of the Internet of ThingsThe Rise of the Internet of Things
The Rise of the Internet of ThingsWestbase.io
 
Casing3d opengl
Casing3d openglCasing3d opengl
Casing3d openglgowell
 

Destaque (6)

How to configure an environment to cross-compile applications for beagleboard-xM
How to configure an environment to cross-compile applications for beagleboard-xMHow to configure an environment to cross-compile applications for beagleboard-xM
How to configure an environment to cross-compile applications for beagleboard-xM
 
Company profile
Company profileCompany profile
Company profile
 
Scrabble
ScrabbleScrabble
Scrabble
 
Logging develop
Logging developLogging develop
Logging develop
 
The Rise of the Internet of Things
The Rise of the Internet of ThingsThe Rise of the Internet of Things
The Rise of the Internet of Things
 
Casing3d opengl
Casing3d openglCasing3d opengl
Casing3d opengl
 

Semelhante a 使用Lua提高开发效率

Docker容器微服務 x WorkShop
Docker容器微服務 x WorkShopDocker容器微服務 x WorkShop
Docker容器微服務 x WorkShopPhilip Zheng
 
Lua 语言介绍
Lua 语言介绍Lua 语言介绍
Lua 语言介绍gowell
 
給 iOS 工程師的 Flutter 開發
給 iOS 工程師的 Flutter 開發給 iOS 工程師的 Flutter 開發
給 iOS 工程師的 Flutter 開發Weizhong Yang
 
docker intro
docker introdocker intro
docker introkoji lin
 
OpenResty/Lua Practical Experience
OpenResty/Lua Practical ExperienceOpenResty/Lua Practical Experience
OpenResty/Lua Practical ExperienceHo Kim
 
自动化运维管理
自动化运维管理自动化运维管理
自动化运维管理frankwsj
 
基于Symfony框架下的快速企业级应用开发
基于Symfony框架下的快速企业级应用开发基于Symfony框架下的快速企业级应用开发
基于Symfony框架下的快速企业级应用开发mysqlops
 
NodeJS基礎教學&簡介
NodeJS基礎教學&簡介NodeJS基礎教學&簡介
NodeJS基礎教學&簡介GO LL
 
Docker一期培训
Docker一期培训Docker一期培训
Docker一期培训青帅 常
 
2, OCP - installing and creating a database
2, OCP - installing and creating a database2, OCP - installing and creating a database
2, OCP - installing and creating a databaseted-xu
 
Docker Compose
Docker ComposeDocker Compose
Docker ComposeMiles Chou
 
2012 java two-desktop-appliction-using-j-ruby-with-swt
2012 java two-desktop-appliction-using-j-ruby-with-swt2012 java two-desktop-appliction-using-j-ruby-with-swt
2012 java two-desktop-appliction-using-j-ruby-with-swttka
 
Build desktop app_by_xulrunner
Build desktop app_by_xulrunnerBuild desktop app_by_xulrunner
Build desktop app_by_xulrunnerRack Lin
 
Erlang Practice
Erlang PracticeErlang Practice
Erlang Practicelitaocheng
 
Clipper@datacon.2019.tw
Clipper@datacon.2019.twClipper@datacon.2019.tw
Clipper@datacon.2019.twWei-Yu Chen
 
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)acqua young
 

Semelhante a 使用Lua提高开发效率 (20)

Docker容器微服務 x WorkShop
Docker容器微服務 x WorkShopDocker容器微服務 x WorkShop
Docker容器微服務 x WorkShop
 
Docker應用
Docker應用Docker應用
Docker應用
 
Lua 语言介绍
Lua 语言介绍Lua 语言介绍
Lua 语言介绍
 
給 iOS 工程師的 Flutter 開發
給 iOS 工程師的 Flutter 開發給 iOS 工程師的 Flutter 開發
給 iOS 工程師的 Flutter 開發
 
docker intro
docker introdocker intro
docker intro
 
运维自动化
运维自动化运维自动化
运维自动化
 
OpenResty/Lua Practical Experience
OpenResty/Lua Practical ExperienceOpenResty/Lua Practical Experience
OpenResty/Lua Practical Experience
 
自动化运维管理
自动化运维管理自动化运维管理
自动化运维管理
 
基于Symfony框架下的快速企业级应用开发
基于Symfony框架下的快速企业级应用开发基于Symfony框架下的快速企业级应用开发
基于Symfony框架下的快速企业级应用开发
 
NodeJS基礎教學&簡介
NodeJS基礎教學&簡介NodeJS基礎教學&簡介
NodeJS基礎教學&簡介
 
Docker一期培训
Docker一期培训Docker一期培训
Docker一期培训
 
2, OCP - installing and creating a database
2, OCP - installing and creating a database2, OCP - installing and creating a database
2, OCP - installing and creating a database
 
Html5
Html5Html5
Html5
 
Docker Compose
Docker ComposeDocker Compose
Docker Compose
 
2012 java two-desktop-appliction-using-j-ruby-with-swt
2012 java two-desktop-appliction-using-j-ruby-with-swt2012 java two-desktop-appliction-using-j-ruby-with-swt
2012 java two-desktop-appliction-using-j-ruby-with-swt
 
Build desktop app_by_xulrunner
Build desktop app_by_xulrunnerBuild desktop app_by_xulrunner
Build desktop app_by_xulrunner
 
Erlang Practice
Erlang PracticeErlang Practice
Erlang Practice
 
Clipper@datacon.2019.tw
Clipper@datacon.2019.twClipper@datacon.2019.tw
Clipper@datacon.2019.tw
 
Inside VCL
Inside VCLInside VCL
Inside VCL
 
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)
Install oracle ebs r12.1.1 on OEL5.6 x86(include demo)
 

Mais de gowell

Kernel init
Kernel initKernel init
Kernel initgowell
 
Logging introduce
Logging introduceLogging introduce
Logging introducegowell
 
Script meta
Script metaScript meta
Script metagowell
 
Script binding
Script bindingScript binding
Script bindinggowell
 
Pytables
PytablesPytables
Pytablesgowell
 
从动态说开去
从动态说开去从动态说开去
从动态说开去gowell
 

Mais de gowell (6)

Kernel init
Kernel initKernel init
Kernel init
 
Logging introduce
Logging introduceLogging introduce
Logging introduce
 
Script meta
Script metaScript meta
Script meta
 
Script binding
Script bindingScript binding
Script binding
 
Pytables
PytablesPytables
Pytables
 
从动态说开去
从动态说开去从动态说开去
从动态说开去
 

使用Lua提高开发效率

  • 1. lua介绍 页码,1/10 介 lua介绍 Author: 罗进 <luojinlj@gmail.com> Version: 1 使用lua提高开发效率 议程 • 缘起 • lua特点 • lua语法 • lua库,c扩展 • iphone-wax开发介绍 • 迅雷插件开发介绍 • wireshark插件开发介绍 file:///C:/lua.htm 2011/5/12
  • 2. lua介绍 页码,2/10 缘起 • 工作中使用c++ • 新产品需求不定 • 时间浪费在编译、部署、执行上 • --lua可以在应用程序运行期修改代码 lua特点 特 • 目的:嵌入宿主程序执行,只是个核。 • 快:基于寄存器的虚拟机,与宿主程序在栈上交互 • 小:164k,可裁剪更小。python2100k • 省:自动垃圾收集、弱类型、单一数据结构,扩展c简单 • 稳定:5.1版2006发布 file:///C:/lua.htm 2011/5/12
  • 3. lua介绍 页码,3/10 lua语法:与python区别 语法:与 区 lua • local,if then end, for do end,建议2个空格缩进 • 迭代器少,只有一个tabel数据结构,强大的闭包 • 继承使用prototype,即metatable中的__index(),用table模拟 • 文档少,第三方库少,源代码好,与c结合好,调试方便 python • global,if :,for :,统一缩进 • 生成式[d for d in data],listdicttuple...,够用的lambda, • 文档多,第三方库多,源代码不好 file:///C:/lua.htm 2011/5/12
  • 4. lua介绍 页码,4/10 lua库,c扩展 库 扩 • lua for windows:第三方库非官方合集 • alien:同python的ctypes • penlight:自称battery include,借鉴python • luarocks:同python的easy_install(PEAK) • 自己扩展 L=luaL_newstate(); luaL_openlibs(L); // init luaL_dofile("") // readfile and compile lua_getglobal(L, func_name) // find func in global table lua_pushinteger() // parameter push to stack for called lua_pcall(L, narg, nresult, 0) // call lua_tonumber() // result file:///C:/lua.htm 2011/5/12
  • 5. lua介绍 页码,5/10 开发介 iphone-wax开发介绍 开发 为什么用lua写iphone 写 • objc不如lua好用 • 轻松垃圾收集(java),非引用计数(python) • 更少的代码,你懂得 • cocoa无缝集成,NSDictionary等的自动转换,自定义控件 • 更强的HTTP功能 • 闭包 • 正则 file:///C:/lua.htm 2011/5/12
  • 6. lua介绍 页码,6/10 代 iphone代码流 UIApplication-> UIAppDelegate-> applicationDidFinishlaunching() // add controllers for callbacks UITableViewController *tableViewController; UIWindow *window; tableViewController = [[UITableViewController alloc]]; [window addSubview:tableViewController.view]; [window make key and visible] objc class目录:app由多个controller+view组成,含.h .m文件 lua script目录:appDelegate.lua,viewController.lua file:///C:/lua.htm 2011/5/12
  • 7. lua介绍 页码,7/10 代 wax代码流 main.m wax_start(char *initScript, lua_CFunction extension, ...); wax_setup(); luaopen_wax_class(L); //lua访问cocoa Finds an ObjC class, //__index() Creates a new ObjC class//__call() luaopen_wax_instance(L); //Cocoa 对象 luaopen_wax_struct(L); //cocoa struct Load extentions, stdlib //lua的json、xml、http等库 luaL_dostring(L, initScript) //加载用户代码 wax_startWithServer(); //交互命令控制显示 wax_end(); //lua_close(wax_currentLuaState()); • waxClass{"TwitterTableViewController", UITableViewController} • 继承 类 , 功能 数 迅雷插 开发介 迅雷插件开发介绍 图 file:///C:/lua.htm 2011/5/12
  • 8. lua介绍 页码,8/10 迅雷插 开发介 迅雷插件开发介绍 addin.cfg //应用的相关信息 XAR/onload.lua // main() function OnMyIconClick(self) local tabCtrl = XLGetGlobal("xunlei.UIControlProvider").GetMainWndTab() local index = tabCtrl:GetItemPosByTitle("MyApp") tabCtrl:SelectItem(index) end local addin_mgr = XLGetGlobal("xunlei.AddinManagerHelper") addin_mgr.RegisterService("MyApp", "我的应用", "icon", "", OnMyIconClick, nil) XAR/layout/Control.xml //界面 XAR/layout/Control.cml.lua //逻辑 插 开发介 wireshark插件开发介绍 图 file:///C:/lua.htm 2011/5/12
  • 9. lua介绍 页码,9/10 插 开发介 wireshark插件开发介绍 dofile("myProto.lua") // init.lua, wireshake调用 local protocal = Proto("myProto","myProto xxx") //新协议 local field1 = ProtoField.bytes("myProto.identifier","Identifier") //协议字段 protocal.fields = { field1, ..., } //协议构造 function protocal.dissector(buf,pkt,root) //回调:解析协议后,将数据加入指定字段 local t = root:add(protocal,buf) t:add(field1,v_identifier) ... end Ref • lua http://lua-users.org/wiki/SampleCode • internal http://simohayha.iteye.com/category/84720 • wax https://github.com/probablycorey/wax • 迅雷 http://xldoc.xl7.xunlei.com/0000000024/00000000240000700004.html • wireshark http://yoursunny.com/study/IS409/ScoreBoard.htm]] • S5 http://meyerweb.com/eric/tools/s5/ • rst http://docutils.sourceforge.net/rst.html • rst2s5 http://docutils.sourceforge.net/docs/user/slide-shows.html • s5定 http://blog.zoomquiet.org/pyblosxom/utility/py4str/StructuredText/rst2s5-usage-2010-09-18-23-23.html file:///C:/lua.htm 2011/5/12
  • 10. lua介绍 页码,10/10 FAQ FAQ file:///C:/lua.htm 2011/5/12