aboutsummaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-09-05 15:30:45 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-09-05 15:30:45 -0300
commit14e416355f83cf0a1b871eedec2c92b86dbe76d6 (patch)
tree620c7fa0b811d5f91d3d2f9b4879b289df6d137c /manual
parentf33cda8d6eb1cac5b9042429e85f1096175c7ca5 (diff)
downloadlua-14e416355f83cf0a1b871eedec2c92b86dbe76d6.tar.gz
lua-14e416355f83cf0a1b871eedec2c92b86dbe76d6.tar.bz2
lua-14e416355f83cf0a1b871eedec2c92b86dbe76d6.zip
Added suport for Fixed Buffers
A fixed buffer keeps a binary chunk "forever", so that the program does not need to copy some of its parts when loading it.
Diffstat (limited to 'manual')
-rw-r--r--manual/manual.of17
1 files changed, 16 insertions, 1 deletions
diff --git a/manual/manual.of b/manual/manual.of
index c16039b4..3eab69fa 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -2730,7 +2730,8 @@ For such errors, Lua does not call the @x{message handler}.
2730 2730
2731@item{@defid{LUA_ERRERR}| error while running the @x{message handler}.} 2731@item{@defid{LUA_ERRERR}| error while running the @x{message handler}.}
2732 2732
2733@item{@defid{LUA_ERRSYNTAX}| syntax error during precompilation.} 2733@item{@defid{LUA_ERRSYNTAX}| syntax error during precompilation
2734or format error in a binary chunk.}
2734 2735
2735@item{@defid{LUA_YIELD}| the thread (coroutine) yields.} 2736@item{@defid{LUA_YIELD}| the thread (coroutine) yields.}
2736 2737
@@ -3646,6 +3647,18 @@ and loads it accordingly (see program @idx{luac}).
3646The string @id{mode} works as in function @Lid{load}, 3647The string @id{mode} works as in function @Lid{load},
3647with the addition that 3648with the addition that
3648a @id{NULL} value is equivalent to the string @St{bt}. 3649a @id{NULL} value is equivalent to the string @St{bt}.
3650Moreover, it may have a @Char{B} instead of a @Char{b},
3651meaning a @emphx{fixed buffer} with the binary dump.
3652
3653A fixed buffer means that the address returned by the reader function
3654should contain the chunk until everything created by the chunk has
3655been collected.
3656(In general, a fixed buffer would keep the chunk
3657as its contents until the end of the program,
3658for instance with the chunk in ROM.)
3659Moreover, for a fixed buffer,
3660the reader function should return the entire chunk in the first read.
3661(As an example, @Lid{luaL_loadbufferx} does that.)
3649 3662
3650@id{lua_load} uses the stack internally, 3663@id{lua_load} uses the stack internally,
3651so the reader function must always leave the stack 3664so the reader function must always leave the stack
@@ -5688,6 +5701,8 @@ This function returns the same results as @Lid{lua_load}.
5688@id{name} is the chunk name, 5701@id{name} is the chunk name,
5689used for debug information and error messages. 5702used for debug information and error messages.
5690The string @id{mode} works as in the function @Lid{lua_load}. 5703The string @id{mode} works as in the function @Lid{lua_load}.
5704In particular, this function supports mode @Char{B} for
5705fixed buffers.
5691 5706
5692} 5707}
5693 5708