Lua学习系列(一)
从现在开始,打算学习一门新的脚本语言-lua.
1.什么是lua?
a) lua1
• Lua 1.0 was implemented as a library, in less then 6000 lines of C
• “The simplest thing that could possibly work”: compiler used lex and yacc, simple stack based virtual machine, linked lists for associative arrays
• Some of the syntax still lives in the current version:
• Lua 1.1 just added a reference manual, and a cleaned-up C API
b)lua2
• From Lua 2.1 (February 1995) to Lua 2.5 (November 1996)
• Object oriented programming via delegation
• Pattern matching in the standard library
• Hooks for writing debuggers
• First users outside Tecgraf, with papers in Software: Practice and Experience and Dr. Dobb's Journal
• LucasArts begins using Lua in games
c)lua3
• From Lua 3.0 (September 1997) to Lua 3.2 (September de 1999)
• Anonymous functions and a restricted form of closures give better support for functional programming, which would mature in Lua 5
• Major refactoring in the source code
• The next version brings big changes to the C API, so some applications from this time still embed this version of Lua
d)lua4
• A single version, Lua 4.0, released on November 2000
• C API completely redone, using the stack model that we will see in this course
• An application can now have several independent instances of the Lua interpreter
• The standard library has been rewritten to use just the public C API, reinforcing the separation between the core and the standard libraries
e)lua5
• From Lua 5.0 (April 2003) to Lua 5.2, the current version, released December 2011
• Maturity of the language, and the release of the “Programming in Lua” book
• Several big changes: metatables, true lexical scope for anynonymous functions, the module system, coroutines, lexical environments…
• Changes in the implementation: more efficient register-based virtual machine, replacing the stack-based one, an incremental garbage collector for shorter pauses
• The implementation now has around 20.000 lines of code, 3x Lua 1.0
f)lua today
• Current license is the MIT license, free for both non-commercial and commercial use
• Open language, but closed development: new releases are still the responsibility of the three original authors
• Big community participation in the lua-l mailing list and the lua-users wiki
• A package manager, LuaRocks, and alternative Lua implementations: LuaJIT, JVM, .NET, JavaScript...
• Several frameworks for developing mobile games: Corona, Gideros, Codea, MOAI...
2.lua应用在哪里?
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 25岁的心里话
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现