按年被提到
20082024 · 12 次2026
开源书›编程语言·No.50·简称 PiL

Programming in Lua (first edition)

Lua 程序设计(第一版)
Roberto Ierusalimschy

Lua 作者亲著的权威入门,简洁而信息密集

免费阅读 ↗
被推荐 · 82 人首次 2008-10-20 · 最近 2025-11-25官方免费在线(版权保留,作者或出版社免费放出)
82不同的人
66活跃月份
19有推荐的月份
80讨论串

Lua 语言设计者之一 Roberto Ierusalimschy 写的 Lua 教程,这里是官网免费放出的第一版。从基本语法讲到表、函数、闭包、协程、面向对象和完整示例,行文简练,类似 Lua 界的 K&R。因为是第一版,内容对应较早的 Lua 版本,新特性需对照手册和新版。

HN 为什么推荐它

HN 上的人长期把它当作学 Lua 的标准入门书,称赞作者就是语言设计者、写得清楚简洁,尤其是协程、表和完整示例几章;也常建议配合官方参考手册读。有一条意见是 Lua 的面向对象文档分散。

难度 2 / 5约 20 小时
适合谁

想系统学习 Lua 的程序员

读之前最好知道
1基本编程经验

怎么读

由 Claude 根据这本书和 HN 上的说法整理,可能有错
  1. 1从头读到表和函数相关章节,并在 Lua 解释器里实际运行
  2. 2协程与完整示例章节值得精读
  3. 3读时对照当前 Lua 版本的参考手册,留意与第一版的差异
  4. 4有 C 语言背景的读者可再看与 C 交互的部分

HN 书评

推荐在前,同类按时间 · 每本最多保留 20 条,统计用全部提及 · 作者本人贴的不算
推荐silentbicycle · 2008-10

“See also: Chapter 16 (OO) in _Programming in Lua_. The first edition is available online: Programming in Lua (first edition)”

补充指出 PIL 第 16 章讲 OO,第一版可在线读
The Universal Design Pattern原评论 ↗
推荐palish · 2009-01

“To get started with Lua, I'd recommend PIL: Programming in Lua (first edition)”

推荐用 PIL 入门 Lua
Lua vs Ruby benchmarks (similarly "high-level" languages, insanely different performance)原评论 ↗
推荐enduser · 2009-03

“Programming in Lua is an excellent example of what you're looking for.”

称它是程序员学新语言的绝佳范例
Ask HN: Good Programming Books to Teach Programmers New Languages?原评论 ↗
推荐joeyo · 2009-06

“Programming in Lua has a nice example of a maze game where state is passed around by emitting functions. It's a toy problem, but I think it's instructive”

拿它里面用函数传递状态的迷宫例子说明,觉得很有启发
Admitting that Functional Programming Can Be Awkward原评论 ↗
推荐joeyo · 2009-07

“You can read about lua tables here: Programming in Lua (first edition)”

指向它了解 Lua table
Mythryl Programming Language 原评论 ↗
推荐pygy_ · 2010-02

“The "Programming in Lua" book, by one of the authors of the language is far more friendly (an excellent book actually, the first version is available online for free: Programming in Lua (first edition)).”

称它比官方资料更友好,第一版可免费在线读
What are the semantics of your favourite programming language?原评论 ↗
看全部 20 条 →
推荐MattJ100 · 2010-03

“See Programming in Lua (first edition) for a bit more info.”

指向它了解 Lua 模式匹配的更多信息
Regular Expression Matching can be Ugly and Slow原评论 ↗
推荐telemachos · 2011-06

“Roberto Ierusalimschy's Programming in Lua[1] comes to mind.”

推荐它作为小而精的编程书之一
Blunt and necessary review of programming language books.原评论 ↗
推荐xolox · 2011-07

“The first edition of "Programming in Lua" is available for free online and might make for more interesting reading than the reference manual: Programming in Lua (first edition)”

推荐免费的第一版,比参考手册读起来更有意思
Lua/APR - proper standard library for Lua原评论 ↗
推荐reginaldo · 2011-07

“IMHO the gems in Chapter 10 (Complete Examples) and the clear explanation of coroutines are alone worth the price.”

称第 10 章完整示例和 coroutine 讲解就值回书价
Lua/APR - proper standard library for Lua原评论 ↗
推荐huyegn · 2011-07

“If you liked Kernighan and Ritchie's "The C Programming Language", then you'll love "Programming In Lua".”

说喜欢 K&R 的人也会爱上它
Lua/APR - proper standard library for Lua原评论 ↗
推荐snogglethorpe · 2012-08

“For those things, PiL ("Programming in Lua") is a much better resource.”

认为讲 Lua 特性的概览和示例,PIL 好得多
Busted: elegant unit testing for Lua原评论 ↗
推荐dottrap · 2014-05

“There is a really nice example of the "goto" semantic for proper tail calls in "Programming in Lua".”

举它的迷宫例子说明 tail call 如何等同 goto
Tail Calls, Optimization, and ES6原评论 ↗
推荐Gracana · 2015-12

“"Programming in Lua" is Lua's K&R. It is a very well written technical book.”

称它是 Lua 界的 K&R,写得很好
LÖVE 0.10 released with iOS and Android support原评论 ↗
推荐LewisJEllis · 2015-12

“For serious depth, the two recommended by Gracana, PIL[4] and the reference manual[5], are fantastic.”

称它和参考手册都是深入学 Lua 的绝佳资料
LÖVE 0.10 released with iOS and Android support原评论 ↗
推荐wahern · 2021-01

“Never mind Lua tutorials. Just read the manual, (链接), and maybe the canonical Programming in Lua book, Programming in Lua (first edition)”

建议别看教程,读手册再加这本经典
Lua, a Misunderstood Language原评论 ↗
推荐ufo · 2022-06

“For Lua documentation, I recommend the Programming in Lua book, from Roberto Ierusalimschy (lead Lua dev).”

推荐它作为 Lua 文档,作者是 Lua 主要开发者
Comparing Implementations of the Monkey Language VIII: Ruby, Python and Lua原评论 ↗
推荐capableweb · 2022-07

“The official book is a great start: Programming in Lua (first edition)”

称这本官方书是学 Lua 的好起点
Mpv – A free, open source, and cross-platform media player原评论 ↗
推荐dtagames · 2022-10

“The Lua documentation is sparse but pretty complete and the PIL book is considered the standard. See what you think... [0]”

称官方文档简略,PIL 是公认的标准书
Ask HN: Architecture for embedding a language in my program原评论 ↗
批评smcin · 2024-01

“Why is the basic documentation [1] on whether/how to implement OO Lua so contradictory and all over the place?”

批评 Lua 里实现 OO 的基础文档前后矛盾、杂乱
Show HN: Boardzilla, a framework for making web-based board games原评论 ↗