mirror of
https://github.com/lua/lua
synced 2026-09-27 00:28:25 +03:00
Explanation about char* parameters in the C API
This commit is contained in:
parent
3360710bd3
commit
cfcaa9493b
1 changed files with 13 additions and 1 deletions
|
|
@ -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}.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue