diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-09-05 15:30:45 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-09-05 15:30:45 -0300 |
| commit | 14e416355f83cf0a1b871eedec2c92b86dbe76d6 (patch) | |
| tree | 620c7fa0b811d5f91d3d2f9b4879b289df6d137c /manual | |
| parent | f33cda8d6eb1cac5b9042429e85f1096175c7ca5 (diff) | |
| download | lua-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.of | 17 |
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 |
| 2734 | or 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}). | |||
| 3646 | The string @id{mode} works as in function @Lid{load}, | 3647 | The string @id{mode} works as in function @Lid{load}, |
| 3647 | with the addition that | 3648 | with the addition that |
| 3648 | a @id{NULL} value is equivalent to the string @St{bt}. | 3649 | a @id{NULL} value is equivalent to the string @St{bt}. |
| 3650 | Moreover, it may have a @Char{B} instead of a @Char{b}, | ||
| 3651 | meaning a @emphx{fixed buffer} with the binary dump. | ||
| 3652 | |||
| 3653 | A fixed buffer means that the address returned by the reader function | ||
| 3654 | should contain the chunk until everything created by the chunk has | ||
| 3655 | been collected. | ||
| 3656 | (In general, a fixed buffer would keep the chunk | ||
| 3657 | as its contents until the end of the program, | ||
| 3658 | for instance with the chunk in ROM.) | ||
| 3659 | Moreover, for a fixed buffer, | ||
| 3660 | the 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, |
| 3651 | so the reader function must always leave the stack | 3664 | so 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, |
| 5689 | used for debug information and error messages. | 5702 | used for debug information and error messages. |
| 5690 | The string @id{mode} works as in the function @Lid{lua_load}. | 5703 | The string @id{mode} works as in the function @Lid{lua_load}. |
| 5704 | In particular, this function supports mode @Char{B} for | ||
| 5705 | fixed buffers. | ||
| 5691 | 5706 | ||
| 5692 | } | 5707 | } |
| 5693 | 5708 | ||
