mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
FFI: Clarify docs wrt. string initializers for byte arrays.
This commit is contained in:
parent
29e89adfa7
commit
e613cb7695
@ -461,8 +461,8 @@ when a single initializer is given. Otherwise they are treated like
|
|||||||
regular arrays.</li>
|
regular arrays.</li>
|
||||||
|
|
||||||
<li>Aggregate types (arrays and structs) accept either a single
|
<li>Aggregate types (arrays and structs) accept either a single
|
||||||
<a href="#init_table">table initializer</a> or a flat list of initializers.
|
<a href="#init_table">table initializer</a> or a flat list of
|
||||||
Byte arrays can be initialized with a Lua string, too.</li>
|
initializers.</li>
|
||||||
|
|
||||||
<li>The elements of an array are initialized, starting at index zero.
|
<li>The elements of an array are initialized, starting at index zero.
|
||||||
If a single initializer is given for an array, it's repeated for all
|
If a single initializer is given for an array, it's repeated for all
|
||||||
@ -470,6 +470,10 @@ remaining elements. This doesn't happen if two or more initializers
|
|||||||
are given: all remaining uninitialized elements are filled with zero
|
are given: all remaining uninitialized elements are filled with zero
|
||||||
bytes.</li>
|
bytes.</li>
|
||||||
|
|
||||||
|
<li>Byte arrays may also be initialized with a Lua string. This copies
|
||||||
|
the whole string plus a terminating zero-byte. The copy stops early only
|
||||||
|
if the array has a known, fixed size.</li>
|
||||||
|
|
||||||
<li>The fields of a <tt>struct</tt> are initialized in the order of
|
<li>The fields of a <tt>struct</tt> are initialized in the order of
|
||||||
their declaration. Uninitialized fields are filled with zero
|
their declaration. Uninitialized fields are filled with zero
|
||||||
bytes.</li>
|
bytes.</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user