From cfcaa9493b783527e5b5dfb71afb51602b3bccac Mon Sep 17 00:00:00 2001 From: Roberto I Date: Fri, 23 Jan 2026 16:25:18 -0300 Subject: Explanation about char* parameters in the C API --- manual/manual.of | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'manual') diff --git a/manual/manual.of b/manual/manual.of index 09075346..893592da 100644 --- a/manual/manual.of +++ b/manual/manual.of @@ -2692,7 +2692,19 @@ which behaves like a nil value. @sect3{constchar|@title{Pointers to Strings} -Several functions in the API return pointers (@T{const char*}) +Several functions in the API accept pointers (@T{const char*}) +to C strings. +Some of there parameters have an associated length (@T{size_t}). +Unless stated otherwise, +when there is an associated length, +the string can contain embedded zeros; +moreover, the pointer can be @id{NULL} if the length is zero. +When there is no associated length, +the pointer must point to a zero-terminated string. +In any case, the string contents should remain unchanged +until the function returns. + +Several functions in the API also return pointers (@T{const char*}) to Lua strings in the stack. (See @Lid{lua_pushfstring}, @Lid{lua_pushlstring}, @Lid{lua_pushstring}, and @Lid{lua_tolstring}. -- cgit v1.2.3-55-g6feb