您好,欢迎光临本网站![请登录][注册会员]  
文件名称: lua程序设计中文版
  所属分类: 其它
  开发工具:
  文件大小: 3mb
  下载次数: 0
  上传时间: 2011-03-19
  提 供 者: jon***
 详细说明: lua程序设计中文手册Programming in Lua 作者:Roberto Ierusalimschy 第一篇 语言 ................................................................................................................................. 1 第0章 序言 ................................................................................................................................. 1 0.1 序言 .................................................................................................................................... 1 0.2 Lua的使用者 ....................................... ............................................................................... 2 0.3 Lua的相关资源 .................................................................................................................. 3 0.4 本书的体例 ........................................................................................................................ 3 0.5 关于本书 ............................................................................................................................ 3 0.6 感谢 .................................................................................................................................... 4 第1章 起点 ................................................................................................................................. 5 1.1 Chunks ................................................................................................................................. 5 1.2 全局变量 ............................................................................................................................ 7 1.3 词法约定 ............................................................................................................................ 7 1.4 命令行方式 ........................................................................................................................ 7 第2章 类型和值 ......................................................................................................................... 9 2.1 Nil ........................................................................................................................................ 9 2.2 Booleans .............................................................................................................................. 9 2.3 Numbers............................................................................................................................. 10 2.4 Strings ................................................................................................................................ 10 2.5 Functions ........................................................................................................................... 12 2.6 Userdata and Threads ........................................................................................................ 12 第3章 表达式 ........................................................................................................................... 13 3.1 算术运算符 ...................................................................................................................... 13 3.2 关系运算符 ...................................................................................................................... 13 3.3 逻辑运算符 ...................................................................................................................... 13 3.4 连接运算符 ...................................................................................................................... 14 3.5 优先级 .............................................................................................................................. 15 3.6 表的构造 ........................................................................................................................... 15 第4章 基本语法 ....................................................................................................................... 18 4.1 赋值语句 .......................................................................................................................... 18 4.2 局部变量与代码块(block) ......................................................................................... 19 4.3 控制结构语句 .................................................................................................................. 20 Programming in Lua Copyright ® 2005, Roberto Ierusalimschy & www.luachina.net iv 4.4 break和return语句 .......................................................................................................... 23 第5章 函数 ............................................................................................................................... 24 5.1 多返回值 .......................................................................................................................... 25 5.2 可变参数 .......................................................................................................................... 27 5.3 命名参数 .......................................................................................................................... 28 第6章 再论函数 ....................................................................................................................... 30 6.1 闭包 .................................................................................................................................. 32 6.2 非全局函数 ...................................................................................................................... 34 6.3 正确的尾调用(Proper Tail Calls) ............................................................................... 36 第7章 迭代器与泛型 for .......................................................................................................... 40 7.1 迭代器与闭包 .................................................................................................................. 40 7.2 范性for的语义 ................................................................................................................ 42 7.3 无状态的迭代器 .............................................................................................................. 43 7.4 多状态的迭代器 .............................................................................................................. 44 7.5 真正的迭代器 .................................................................................................................. 45 第8章 编译·运行·错误信息 ............................................................................................... 47 8.1 require函数 ....................................................................................................................... 49 8.2 C Packages ......................................................................................................................... 50 8.3 错误 .................................................................................................................................. 51 8.4 异常和错误处理 .............................................................................................................. 52 8.5 错误信息和回跟踪(Tracebacks) ................................................................................ 53 第9章 协同程序 ....................................................................................................................... 56 9.1 协同的基础 ...................................................................................................................... 56 9.2 管道和过滤器 .................................................................................................................. 58 9.3 用作迭代器的协同 .......................................................................................................... 61 9.4 非抢占式多线程 .............................................................................................................. 63 第10章 完整示例 ..................................................................................................................... 68 10.1 Lua作为数据描述语言使用 .......................................................................................... 68 10.2 马尔可夫链算法 ............................................................................................................ 71 第二篇 tables与objects ............................................................................................................. 75 第11章 数据结构 ..................................................................................................................... 76 11.1 数组 ................................................................................................................................ 76 11.2 矩阵和多维数组 ............................................................................................................ 77 11.3 链表 ................................................................................................................................ 78 11.4 队列和双端队列 ............................................................................................................ 78 11.5 集合和包 ........................................................................................................................ 80 11.6 字符串缓冲 .................................................................................................................... 80 第12章 数据文件与持久化 ..................................................................................................... 84 12.1 序列化 ............................................................................................................................ 86 Programming in Lua Copyright ® 2005, Roberto Ierusalimschy & www.luachina.net v 第13章 Metatables and Metamethods ...................................................................................... 92 13.1 算术运算的Metamethods .............................................................................................. 92 13.2 关系运算的Metamethods .............................................................................................. 95 13.3 库定义的Metamethods .................................................................................................. 96 13.4 表相关的Metamethods .................................................................................................. 97 第14章 环境 ........................................................................................................................... 103 14.1 使用动态名字访问全局变量 ...................................................................................... 103 14.2声明全局变量 ............................................................................................................... 104 14.3 非全局的环境 .............................................................................................................. 106 第15章 Packages .................................................................................................................... 109 15.1 基本方法 ...................................................................................................................... 109 15.2 私有成员(Privacy) ................................................................................................... 111 15.3 包与文件 ....................................................................................................................... 112 15.4 使用全局表 ................................................................................................................... 113 15.5 其他一些技巧(Other Facilities) ............................................................................... 115 第16章 面向对象程序设计 .................................................................................................... 118 16.1 类 ................................................................................................................................... 119 16.2 继承 .............................................................................................................................. 121 16.3 多重继承 ...................................................................................................................... 122 16.4 私有性(privacy) ...................................................................................................... 125 16.5 Single-Method的对象实现方法 .................................................................................. 127 第17章 Weak表 ..................................................................................................................... 128 17.1 记忆函数 ...................................................................................................................... 130 17.2 关联对象属性 .............................................................................................................. 131 17.3 重述带有默认值的表 .................................................................................................. 132 第三篇 标准库 ......................................................................................................................... 134 第18章 数学库 ....................................................................................................................... 135 第19章 Table库 ..................................................................................................................... 136 19.1数组大小 ....................................................................................................................... 136 19.2 插入/删除 ..................................................................................................................... 137 19.3 排序 .............................................................................................................................. 137 第20章 String库..................................................................................................................... 140 20.1 模式匹配函数 .............................................................................................................. 141 20.2 模式 .............................................................................................................................. 143 20.3 捕获(Captures) ........................................................................................................ 146 20.4 转换的技巧(Tricks of the Trade) ............................................................................ 151 第21章 IO 库 .......................................................................................................................... 157 21.1 简单I/O 模式 ............................................................................................................... 157 21.2 完全I/O 模式 .............................................................................................................. 160 Programming in Lua Copyright ® 2005, Roberto Ierusalimschy & www.luachina.net vi 第22章 操作系统库 ............................................................................................................... 165 22.1 Date和Time ................................................................................................................. 165 22.2 其它的系统调用 .......................................................................................................... 167 第23章 Debug 库 .................................................................................................................... 169 23.1 自省(Introspective) ................................................................................................. 169 23.2 Hooks ............................................................................................................................. 173 23.3 Profiles ........................................................................................................................... 174 第四篇 C API ........................................................................................................................... 177 第24章 C API纵览 ................................................................................................................ 178 24.1 第一个示例程序 .......................................................................................................... 179 24.2 堆栈 .............................................................................................................................. 181 24.3 C API的错误处理 ........................................................................................................ 186 第25章 扩展你的程序 ........................................................................................................... 188 25.1 表操作 .......................................................................................................................... 189 25.2 调用Lua函数 .............................................................................................................. 193 25.3 通用的函数调用 .......................................................................................................... 195 第26章 调用C 函数 ............................................................................................................... 198 26.1 C 函数........................................................................................................................... 198 26.2 C 函数库....................................................................................................................... 200 第27章 撰写C 函数的技巧 ................................................................................................... 203 27.1 数组操作 ...................................................................................................................... 203 27.2 字符串处理 .................................................................................................................. 204 27.3 在C函数中保存状态 .................................................................................................. 207 第28章 User-Defined Types in C............................................................................................ 212 28.1 Userdata ......................................................................................................................... 212 28.2 Metatables ...................................................................................................................... 215 28.3 访问面向对象的数据 .................................................................................................. 217 28.4 访问数组 ...................................................................................................................... 219 28.5 Light Userdata ............................................................................................................... 220 第29章 资源管理 ................................................................................................................... 222 29.1 目录迭代器 .................................................................................................................. 222 29.2 XML解析 ..................................................................................................................... 225 第四篇 附录 ............................................................................................................................. 234 A. 终端机控制符 ..................................................................................................................... 235 ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: lua 中文
 输入关键字,在本站1000多万海量源码库中尽情搜索: