diff options
Diffstat (limited to 'manual')
-rw-r--r-- | manual/manual.of | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/manual/manual.of b/manual/manual.of index 3eab69fa..9d6a7fd9 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
@@ -3908,6 +3908,40 @@ This function is equivalent to @Lid{lua_pushcclosure} with no upvalues. | |||
3908 | 3908 | ||
3909 | } | 3909 | } |
3910 | 3910 | ||
3911 | @APIEntry{const char *(lua_pushextlstring) (lua_State *L, | ||
3912 | const char *s, size_t len, lua_Alloc falloc, void *ud);| | ||
3913 | @apii{0,1,m} | ||
3914 | |||
3915 | Creates an @emphx{external string}, | ||
3916 | that is, a string that uses memory not managed by Lua. | ||
3917 | The pointer @id{s} points to the exernal buffer | ||
3918 | holding the string content, | ||
3919 | and @id{len} is the length of the string. | ||
3920 | The string should have a zero at its end, | ||
3921 | that is, the condition @T{s[len] == '\0'} should hold. | ||
3922 | |||
3923 | If @id{falloc} is different from @id{NULL}, | ||
3924 | that function will be called by Lua | ||
3925 | when the external buffer is no longer needed. | ||
3926 | The contents of the buffer should not change before this call. | ||
3927 | The function will be called with the given @id{ud}, | ||
3928 | the string @id{s} as the block, | ||
3929 | the length plus one (to account for the ending zero) as the old size, | ||
3930 | and 0 as the new size. | ||
3931 | |||
3932 | Lua always @x{internalizes} strings with lengths up to 40 characters. | ||
3933 | So, for strings in that range, | ||
3934 | this function will immediately internalize the string | ||
3935 | and call @id{falloc} to free the buffer. | ||
3936 | |||
3937 | Even when using an external buffer, | ||
3938 | Lua still has to allocate a header for the string. | ||
3939 | In case of a memory-allocation error, | ||
3940 | Lua will call @id{falloc} before raising the error. | ||
3941 | |||
3942 | } | ||
3943 | |||
3944 | |||
3911 | @APIEntry{const char *lua_pushfstring (lua_State *L, const char *fmt, ...);| | 3945 | @APIEntry{const char *lua_pushfstring (lua_State *L, const char *fmt, ...);| |
3912 | @apii{0,1,v} | 3946 | @apii{0,1,v} |
3913 | 3947 | ||