没有合适的资源?快使用搜索试试~ 我知道了~
首页lua语言参考手册 pdf
LUA的目标是成为一个很容易嵌入其它语言中使用的语言。大多数程序员也认为它的确做到了这一点。 很多应用程序使用LUA作为自己的嵌入式脚本语言,以此来实现可配置性、可扩展性。这其中包括仙境傳說、魔兽世界、战锤40k、博德之门、轩辕剑外传汉之云等。 Lua是一种轻量语言,它的官方版本只包括一个精简的核心和最基本的库。这使得Lua体积小、启动速度快。它用标准C语言编写并以源代码形式开放,编译后仅仅一百餘K,可以很方便的嵌入别的程式裡。和许多"大而全"的语言不一样,网路通讯、图形界面等都没有預設提供。但是Lua可以很容易地被扩展:由宿主语言(通常是C或C++)提供这些功能,Lua可以使用它们,就像是本来就内置的功能一样。事实上,现在已经有很多成熟的扩展模块可供选用。 http://zh.wikipedia.org/wiki/Lua
资源详情
资源推荐
内容目录
Lua 5.1 参考手册.................................................................................................................................8
1 - 介绍.................................................................................................................................................8
2 - 语言.................................................................................................................................................8
2.1 - 词法约定.................................................................................................................................8
2.2 - 值与类型...............................................................................................................................10
2.2.1 - 强制转换........................................................................................................................11
2.3 - 变量.......................................................................................................................................11
2.4 - 语句段(Statement)...........................................................................................................12
2.4.1 - Chunk(语句组).........................................................................................................12
2.4.2 - 语句块...........................................................................................................................12
2.4.3 - 赋值...............................................................................................................................12
2.4.4 - 控制结构.......................................................................................................................13
2.4.5 - For 语句.........................................................................................................................14
2.4.6 - 把函数调用作为语句段...............................................................................................15
2.4.7 - 局部变量声名...............................................................................................................15
2.5 - 表达式...................................................................................................................................15
2.5.1 - 数学运算操作符...........................................................................................................16
2.5.2 - 比较操作符...................................................................................................................16
2.5.3 - 逻辑操作符...................................................................................................................17
2.5.4 - 连接符...........................................................................................................................17
2.5.5 - 取长度操作符...............................................................................................................17
2.5.6 - 优先级...........................................................................................................................18
2.5.7 - Table 构造......................................................................................................................18
2.5.8 - 函数调用.......................................................................................................................19
2.5.9 - 函数定义.......................................................................................................................20
2.6 - 可视规则...............................................................................................................................21
2.7 - 错误处理...............................................................................................................................22
2.8 - Metatable(元表)...............................................................................................................22
2.9 - 环境.......................................................................................................................................27
2.10 - 垃圾收集.............................................................................................................................27
2.10.1 - 垃圾收集的元方法.....................................................................................................28
2.10.2 - Weak Table(弱表)...................................................................................................28
2.11 - Coroutine (协同例程)....................................................................................................29
3 - 程序接口(API)........................................................................................................................30
3.1 - 堆栈.......................................................................................................................................30
3.2 - 堆栈尺寸...............................................................................................................................30
3.3 - 伪索引...................................................................................................................................31
3.4 - C Closure...............................................................................................................................31
3.5 - 注册表...................................................................................................................................31
3.6 - C 中的错误处理...................................................................................................................32
3.7 - 函数和类型...........................................................................................................................32
lua_Alloc...................................................................................................................................32
lua_atpanic................................................................................................................................33
lua_call......................................................................................................................................33
lua_CFunction...........................................................................................................................34
lua_checkstack..........................................................................................................................34
lua_close....................................................................................................................................34
lua_concat.................................................................................................................................35
lua_cpcall..................................................................................................................................35
lua_createtable..........................................................................................................................35
lua_dump...................................................................................................................................35
lua_equal...................................................................................................................................35
lua_error....................................................................................................................................36
lua_gc........................................................................................................................................36
lua_getallocf..............................................................................................................................36
lua_getfenv................................................................................................................................36
lua_getfield................................................................................................................................37
lua_getglobal.............................................................................................................................37
lua_getmetatable.......................................................................................................................37
lua_gettable...............................................................................................................................37
lua_gettop..................................................................................................................................37
lua_insert...................................................................................................................................38
lua_Integer................................................................................................................................38
lua_isboolean............................................................................................................................38
lua_iscfunction..........................................................................................................................38
lua_isfunction............................................................................................................................38
lua_islightuserdata....................................................................................................................38
lua_isnil.....................................................................................................................................38
lua_isnumber.............................................................................................................................39
lua_isstring................................................................................................................................39
lua_istable.................................................................................................................................39
lua_isthread...............................................................................................................................39
lua_isuserdata............................................................................................................................39
lua_lessthan...............................................................................................................................39
lua_load.....................................................................................................................................40
lua_newstate..............................................................................................................................40
lua_newtable.............................................................................................................................40
lua_newthread...........................................................................................................................40
lua_newuserdata........................................................................................................................41
lua_next.....................................................................................................................................41
lua_Number...............................................................................................................................42
lua_objlen..................................................................................................................................42
lua_pcall....................................................................................................................................42
lua_pop......................................................................................................................................42
lua_pushboolean........................................................................................................................43
lua_pushcclosure.......................................................................................................................43
lua_pushcfunction.....................................................................................................................43
lua_pushfstring..........................................................................................................................43
lua_pushinteger.........................................................................................................................44
lua_pushlightuserdata................................................................................................................44
lua_pushlstring..........................................................................................................................44
lua_pushnil................................................................................................................................44
lua_pushnumber........................................................................................................................44
lua_pushstring...........................................................................................................................44
lua_pushthread..........................................................................................................................45
lua_pushvalue............................................................................................................................45
lua_pushvfstring........................................................................................................................45
lua_rawequal.............................................................................................................................45
lua_rawget.................................................................................................................................45
lua_rawgeti................................................................................................................................45
lua_rawset.................................................................................................................................46
lua_rawseti................................................................................................................................46
lua_Reader................................................................................................................................46
lua_register................................................................................................................................46
lua_remove................................................................................................................................46
lua_replace................................................................................................................................47
lua_resume................................................................................................................................47
lua_setallocf..............................................................................................................................47
lua_setfenv................................................................................................................................47
lua_setfield................................................................................................................................47
lua_setglobal.............................................................................................................................48
lua_setmetatable........................................................................................................................48
lua_settable................................................................................................................................48
lua_settop..................................................................................................................................48
lua_State....................................................................................................................................48
lua_status...................................................................................................................................49
lua_toboolean............................................................................................................................49
lua_tocfunction..........................................................................................................................49
lua_tointeger..............................................................................................................................49
lua_tolstring..............................................................................................................................50
lua_tonumber............................................................................................................................50
lua_topointer.............................................................................................................................50
lua_tostring................................................................................................................................50
lua_tothread...............................................................................................................................50
lua_touserdata...........................................................................................................................51
lua_type.....................................................................................................................................51
lua_typename............................................................................................................................51
lua_Writer..................................................................................................................................51
lua_xmove.................................................................................................................................51
lua_yield....................................................................................................................................52
3.8 - 调试接口...............................................................................................................................52
lua_Debug.................................................................................................................................52
lua_gethook...............................................................................................................................53
lua_gethookcount......................................................................................................................53
lua_gethookmask......................................................................................................................53
lua_getinfo................................................................................................................................53
lua_getlocal...............................................................................................................................54
lua_getstack...............................................................................................................................54
lua_getupvalue..........................................................................................................................55
lua_Hook...................................................................................................................................55
lua_sethook...............................................................................................................................55
lua_setlocal................................................................................................................................56
lua_setupvalue...........................................................................................................................56
4 - The Auxiliary Library....................................................................................................................56
4.1 - Functions and Types..............................................................................................................57
luaL_addchar.............................................................................................................................57
luaL_addlstring.........................................................................................................................57
luaL_addsize.............................................................................................................................57
luaL_addstring..........................................................................................................................57
luaL_addvalue...........................................................................................................................57
luaL_argcheck...........................................................................................................................58
luaL_argerror.............................................................................................................................58
luaL_Buffer...............................................................................................................................58
luaL_buffinit.............................................................................................................................59
luaL_callmeta............................................................................................................................59
luaL_checkany..........................................................................................................................59
luaL_checkint............................................................................................................................59
luaL_checkinteger.....................................................................................................................60
luaL_checklong.........................................................................................................................60
luaL_checklstring......................................................................................................................60
luaL_checknumber....................................................................................................................60
luaL_checkoption......................................................................................................................60
luaL_checkstack........................................................................................................................61
luaL_checkstring.......................................................................................................................61
luaL_checktype.........................................................................................................................61
luaL_checkudata.......................................................................................................................61
luaL_dofile................................................................................................................................61
luaL_dostring............................................................................................................................61
luaL_error..................................................................................................................................62
luaL_getmetafield.....................................................................................................................62
luaL_getmetatable.....................................................................................................................62
luaL_gsub..................................................................................................................................62
luaL_loadbuffer.........................................................................................................................62
luaL_loadfile.............................................................................................................................63
luaL_loadstring.........................................................................................................................63
luaL_newmetatable...................................................................................................................63
luaL_newstate...........................................................................................................................63
luaL_openlibs............................................................................................................................64
luaL_optint................................................................................................................................64
luaL_optinteger.........................................................................................................................64
luaL_optlong.............................................................................................................................64
luaL_optlstring..........................................................................................................................64
luaL_optnumber........................................................................................................................65
luaL_optstring...........................................................................................................................65
luaL_prepbuffer.........................................................................................................................65
luaL_pushresult.........................................................................................................................65
luaL_ref.....................................................................................................................................65
luaL_Reg...................................................................................................................................66
luaL_register.............................................................................................................................66
luaL_typename..........................................................................................................................66
luaL_typerror............................................................................................................................67
luaL_unref.................................................................................................................................67
luaL_where................................................................................................................................67
5 - Standard Libraries.........................................................................................................................67
5.1 - Basic Functions.....................................................................................................................68
assert (v [, message]).................................................................................................................68
collectgarbage (opt [, arg])........................................................................................................68
dofile (filename)........................................................................................................................69
error (message [, level])............................................................................................................69
_G..............................................................................................................................................69
getfenv (f)..................................................................................................................................69
getmetatable (object).................................................................................................................70
ipairs (t).....................................................................................................................................70
load (func [, chunkname]).........................................................................................................70
loadfile ([filename])..................................................................................................................70
loadstring (string [, chunkname])..............................................................................................70
next (table [, index])..................................................................................................................71
pairs (t)......................................................................................................................................71
pcall (f, arg1, ···)........................................................................................................................71
print (···)....................................................................................................................................71
rawequal (v1, v2)......................................................................................................................72
rawget (table, index).................................................................................................................72
rawset (table, index, value).......................................................................................................72
select (index, ···)........................................................................................................................72
setfenv (f, table)........................................................................................................................72
setmetatable (table, metatable)..................................................................................................72
tonumber (e [, base]).................................................................................................................73
tostring (e).................................................................................................................................73
type (v)......................................................................................................................................73
unpack (list [, i [, j]]).................................................................................................................73
_VERSION...............................................................................................................................73
xpcall (f, err).............................................................................................................................74
5.2 - Coroutine Manipulation.........................................................................................................74
coroutine.create (f)....................................................................................................................74
coroutine.resume (co [, val1, ···])..............................................................................................74
coroutine.running ()..................................................................................................................74
coroutine.status (co)..................................................................................................................74
coroutine.wrap (f)......................................................................................................................75
coroutine.yield (···)....................................................................................................................75
5.3 - Modules.................................................................................................................................75
module (name [, ···])..................................................................................................................75
require (modname)....................................................................................................................76
package.cpath............................................................................................................................76
package.loaded..........................................................................................................................77
package.loadlib (libname, funcname).......................................................................................77
package.path..............................................................................................................................77
package.preload.........................................................................................................................77
package.seeall (module)............................................................................................................78
5.4 - String Manipulation...............................................................................................................78
string.byte (s [, i [, j]])...............................................................................................................78
string.char (···)...........................................................................................................................78
string.dump (function)..............................................................................................................78
string.find (s, pattern [, init [, plain]]).......................................................................................79
string.format (formatstring, ···).................................................................................................79
string.gmatch (s, pattern)..........................................................................................................79
string.gsub (s, pattern, repl [, n])...............................................................................................80
string.len (s)..............................................................................................................................81
string.lower (s)..........................................................................................................................81
string.match (s, pattern [, init]).................................................................................................81
string.rep (s, n)..........................................................................................................................81
string.reverse (s)........................................................................................................................81
string.sub (s, i [, j])....................................................................................................................82
剩余101页未读,继续阅读
奔跑的蜗牛
- 粉丝: 3
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 中文翻译Introduction to Linear Algebra, 5th Edition 2.1节
- zigbee-cluster-library-specification
- JSBSim Reference Manual
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功