- 1 - 介绍
- 2.1 - 语法约定
- 2.10.1 - 垃圾收集的元方法
- 2.10.2 - Weak Table(弱表)
- 2.10 - 垃圾收集
- 2.11 - Coroutine (协同例程)
- 2.2.1 - 强制转换
- 2.2 - 值与类型
- 2.3 - 变量
- 2.4.1 - Chunk(语句组)
- 2.4.2 - 语句块
- 2.4.3 - 赋值
- 2.4.4 - 控制结构
- 2.4.5 - For 语句
- 2.4.6 - 把函数调用作为语句段
- 2.4.7 - 局部变量声名
- 2.4 - 语句段(Statement)
- 2.5.1 - 数学运算操作符
- 2.5.2 - 比较操作符
- 2.5.3 - 逻辑操作符
- 2.5.4 - 连接符
- 2.5.5 - 取长度操作符
- 2.5.6 - 优先级
- 2.5.7 - Table 构造
- 2.5.8 - 函数调用
- 2.5.9 - 函数定义
- 2.5 - 表达式
- 2.6 - 可视规则
- 2.7 - 错误处理
- 2.8 - Metatable(元表)
- 2.9 - 环境
- 2 - 语言
- 3.1 - 堆栈
- 3.2 - 堆栈尺寸
- 3.3 - 伪索引
- 3.4 - C Closure
- 3.5 - 注册表
- 3.6 - C 中的错误处理
- 3.7 - 函数和类型
- 3.8 - 调试接口
- 3 - 程序接口(API)
- 4.1 - Functions and Types
- 4 - The Auxiliary Library
- 5.1 - Basic Functions
- 5.2 - Coroutine Manipulation
- 5.3 - Modules
- 5.4 - String Manipulation
- 5.5 - Table Manipulation
- 5.6 - Mathematical Functions
- 5.7 - Input and Output Facilities
- 5.8 - Operating System Facilities
- 5.9 - The Debug Library
- 5 - Standard Libraries
- 6 - Lua Stand-alone
- 7.1 - Changes in the Language
- 7.2 - Changes in the Libraries
- 7.3 - Changes in the API
- 7 - Incompatibilities with the Previous Version
- 8 - The Complete Syntax of Lua
- Captures
- Character Class:
- luaL_addchar
- luaL_addlstring
- luaL_addsize
- luaL_addstring
- luaL_addvalue
- luaL_argcheck
- luaL_argerror
- luaL_Buffer
- luaL_buffinit
- luaL_callmeta
- luaL_checkany
- luaL_checkint
- luaL_checkinteger
- luaL_checklong
- luaL_checklstring
- luaL_checknumber
- luaL_checkoption
- luaL_checkstack
- luaL_checkstring
- luaL_checktype
- luaL_checkudata
- luaL_dofile
- luaL_dostring
- luaL_error
- luaL_getmetafield
- luaL_getmetatable
- luaL_gsub
- luaL_loadbuffer
- luaL_loadfile
- luaL_loadstring
- luaL_newmetatable
- luaL_newstate
- luaL_openlibs
- luaL_optint
- luaL_optinteger
- luaL_optlong
- luaL_optlstring
- luaL_optnumber
- luaL_optstring
- luaL_prepbuffer
- luaL_pushresult
- luaL_ref
- luaL_Reg
- luaL_register
- luaL_typename
- luaL_typerror
- luaL_unref
- luaL_where
- lua_Alloc
- lua_atpanic
- lua_call
- lua_CFunction
- lua_checkstack
- lua_close
- lua_concat
- lua_cpcall
- lua_createtable
- lua_Debug
- lua_dump
- lua_equal
- lua_error
- lua_gc
- lua_getallocf
- lua_getfenv
- lua_getfield
- lua_getglobal
- lua_gethook
- lua_gethookcount
- lua_gethookmask
- lua_getinfo
- lua_getlocal
- lua_getmetatable
- lua_getstack
- lua_gettable
- lua_gettop
- lua_getupvalue
- lua_Hook
- lua_insert
- lua_Integer
- lua_isboolean
- lua_iscfunction
- lua_isfunction
- lua_islightuserdata
- lua_isnil
- lua_isnumber
- lua_isstring
- lua_istable
- lua_isthread
- lua_isuserdata
- lua_lessthan
- lua_load
- lua_newstate
- lua_newtable
- lua_newthread
- lua_newuserdata
- lua_next
- lua_Number
- lua_objlen
- lua_pcall
- lua_pop
- lua_pushboolean
- lua_pushcclosure
- lua_pushcfunction
- lua_pushfstring
- lua_pushinteger
- lua_pushlightuserdata
- lua_pushlstring
- lua_pushnil
- lua_pushnumber
- lua_pushstring
- lua_pushthread
- lua_pushvalue
- lua_pushvfstring
- lua_rawequal
- lua_rawget
- lua_rawgeti
- lua_rawset
- lua_rawseti
- lua_Reader
- lua_register
- lua_remove
- lua_replace
- lua_resume
- lua_setallocf
- lua_setfenv
- lua_setfield
- lua_setglobal
- lua_sethook
- lua_setlocal
- lua_setmetatable
- lua_settable
- lua_settop
- lua_setupvalue
- lua_State
- lua_status
- lua_toboolean
- lua_tocfunction
- lua_tointeger
- lua_tolstring
- lua_tonumber
- lua_topointer
- lua_tostring
- lua_tothread
- lua_touserdata
- lua_type
- lua_typename
- lua_Writer
- lua_xmove
- lua_yield
- Pattern:
- Pattern Item:
- assert (v [, message])
- collectgarbage (opt [, arg])
- coroutine.create (f)
- coroutine.resume (co [, val1, ···])
- coroutine.running ()
- coroutine.status (co)
- coroutine.wrap (f)
- coroutine.yield (···)
- debug.debug ()
- debug.getfenv (o)
- debug.gethook ([thread])
- debug.getinfo ([thread,] function [, what])
- debug.getlocal ([thread,] level, local)
- debug.getmetatable (object)
- debug.getregistry ()
- debug.getupvalue (func, up)
- debug.setfenv (object, table)
- debug.sethook ([thread,] hook, mask [, count])
- debug.setlocal ([thread,] level, local, value)
- debug.setmetatable (object, table)
- debug.setupvalue (func, up, value)
- debug.traceback ([thread,] [message])
- dofile (filename)
- error (message [, level])
- getfenv (f)
- getmetatable (object)
- io.close ([file])
- io.flush ()
- io.input ([file])
- io.lines ([filename])
- io.open (filename [, mode])
- io.output ([file])
- io.popen ([prog [, mode]])
- io.read (···)
- io.tmpfile ()
- io.type (obj)
- io.write (···)
- ipairs (t)
- load (func [, chunkname])
- loadfile ([filename])
- loadstring (string [, chunkname])
- math.abs (x)
- math.acos (x)
- math.asin (x)
- math.atan (x)
- math.atan2 (x, y)
- math.ceil (x)
- math.cos (x)
- math.cosh (x)
- math.deg (x)
- math.exp (x)
- math.floor (x)
- math.fmod (x, y)
- math.frexp (x)
- math.huge
- math.ldexp (m, e)
- math.log (x)
- math.log10 (x)
- math.max (x, ···)
- math.min (x, ···)
- math.modf (x)
- math.pi
- math.pow (x, y)
- math.rad (x)
- math.random ([m [, n]])
- math.randomseed (x)
- math.sin (x)
- math.sinh (x)
- math.sqrt (x)
- math.tan (x)
- math.tanh (x)
- module (name [, ···])
- next (table [, index])
- os.clock ()
- os.date ([format [, time]])
- os.difftime (t2, t1)
- os.execute ([command])
- os.exit ([code])
- os.getenv (varname)
- os.remove (filename)
- os.rename (oldname, newname)
- os.setlocale (locale [, category])
- os.time ([table])
- os.tmpname ()
- package.cpath
- package.loaded
- package.loadlib (libname, funcname)
- package.path
- package.preload
- package.seeall (module)
- pairs (t)
- pcall (f, arg1, ···)
- print (···)
- rawequal (v1, v2)
- rawget (table, index)
- rawset (table, index, value)
- require (modname)
- select (index, ···)
- setfenv (f, table)
- setmetatable (table, metatable)
- string.byte (s [, i [, j]])
- string.char (···)
- string.dump (function)
- string.find (s, pattern [, init [, plain]])
- string.format (formatstring, ···)
- string.gmatch (s, pattern)
- string.gsub (s, pattern, repl [, n])
- string.len (s)
- string.lower (s)
- string.match (s, pattern [, init])
- string.rep (s, n)
- string.reverse (s)
- string.sub (s, i [, j])
- string.upper (s)
- table.concat (table [, sep [, i [, j]]])
- table.insert (table, [pos,] value)
- table.maxn (table)
- table.remove (table [, pos])
- table.sort (table [, comp])
- tonumber (e [, base])
- tostring (e)
- type (v)
- unpack (list [, i [, j]])
- xpcall (f, err)
- _G
- _VERSION
- file:close ()
- file:flush ()
- file:lines ()
- file:read (...)
- file:seek ([whence] [, offset])
- file:setvbuf (mode [, size])
- file:write (...)
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
luaL_Buffer
typedef struct luaL_Buffer luaL_Buffer;
Type for a string buffer.
A string buffer allows C code to build Lua strings piecemeal. Its pattern of use is as follows:
- First you declare a variable
b
of typeluaL_Buffer
. - Then you initialize it with a call
luaL_buffinit(L, &b)
. - Then you add string pieces to the buffer calling any of the
luaL_add*
functions. - You finish by calling
luaL_pushresult(&b)
. This call leaves the final string on the top of the stack.
During its normal operation, a string buffer uses a variable number of stack slots. So, while using a buffer, you cannot assume that you know where the top of the stack is. You can use the stack between successive calls to buffer operations as long as that use is balanced; that is, when you call a buffer operation, the stack is at the same level it was immediately after the previous buffer operation. (The only exception to this rule is luaL_addvalue
.) After calling luaL_pushresult
the stack is back to its level when the buffer was initialized, plus the final string on its top.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论