diff options
| author | Roberto I <roberto@inf.puc-rio.br> | 2026-01-23 16:25:18 -0300 |
|---|---|---|
| committer | Roberto I <roberto@inf.puc-rio.br> | 2026-01-23 16:25:18 -0300 |
| commit | cfcaa9493b783527e5b5dfb71afb51602b3bccac (patch) | |
| tree | f6c8d683185a36d5dca81bcfd9ac62c58a3c2a47 /manual/manual.of | |
| parent | 3360710bd3ea8da06fa5062f9d10c2719083097c (diff) | |
| download | lua-cfcaa9493b783527e5b5dfb71afb51602b3bccac.tar.gz lua-cfcaa9493b783527e5b5dfb71afb51602b3bccac.tar.bz2 lua-cfcaa9493b783527e5b5dfb71afb51602b3bccac.zip | |
Explanation about char* parameters in the C API
Diffstat (limited to 'manual/manual.of')
| -rw-r--r-- | manual/manual.of | 14 |
1 files changed, 13 insertions, 1 deletions
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. | |||
| 2692 | 2692 | ||
| 2693 | @sect3{constchar|@title{Pointers to Strings} | 2693 | @sect3{constchar|@title{Pointers to Strings} |
| 2694 | 2694 | ||
| 2695 | Several functions in the API return pointers (@T{const char*}) | 2695 | Several functions in the API accept pointers (@T{const char*}) |
| 2696 | to C strings. | ||
| 2697 | Some of there parameters have an associated length (@T{size_t}). | ||
| 2698 | Unless stated otherwise, | ||
| 2699 | when there is an associated length, | ||
| 2700 | the string can contain embedded zeros; | ||
| 2701 | moreover, the pointer can be @id{NULL} if the length is zero. | ||
| 2702 | When there is no associated length, | ||
| 2703 | the pointer must point to a zero-terminated string. | ||
| 2704 | In any case, the string contents should remain unchanged | ||
| 2705 | until the function returns. | ||
| 2706 | |||
| 2707 | Several functions in the API also return pointers (@T{const char*}) | ||
| 2696 | to Lua strings in the stack. | 2708 | to Lua strings in the stack. |
| 2697 | (See @Lid{lua_pushfstring}, @Lid{lua_pushlstring}, | 2709 | (See @Lid{lua_pushfstring}, @Lid{lua_pushlstring}, |
| 2698 | @Lid{lua_pushstring}, and @Lid{lua_tolstring}. | 2710 | @Lid{lua_pushstring}, and @Lid{lua_tolstring}. |
