diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/extensions.html | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/extensions.html b/doc/extensions.html index 48f4220c..3443f201 100644 --- a/doc/extensions.html +++ b/doc/extensions.html | |||
@@ -217,6 +217,22 @@ tables if the final table size is known and automatic table resizing is | |||
217 | too expensive. | 217 | too expensive. |
218 | </p> | 218 | </p> |
219 | 219 | ||
220 | <h3 id="table_clear"><tt>table.clear(tab)</tt> clears a table</h3> | ||
221 | <p> | ||
222 | An extra library function <tt>table.clear()</tt> can be made available | ||
223 | via <tt>require("table.clear")</tt>. This clears all keys and values | ||
224 | from a table, but preserves the allocated array/hash sizes. This is | ||
225 | useful when a table, which is linked from multiple places, needs to be | ||
226 | cleared and/or when recycling a table for use by the same context. This | ||
227 | avoids managing backlinks, saves an allocation and the overhead of | ||
228 | incremental array/hash part growth. | ||
229 | </p> | ||
230 | <p> | ||
231 | Please note this function is meant for very specific situations. In most | ||
232 | cases it's better to replace the (usually single) link with a new table | ||
233 | and let the GC do its work. | ||
234 | </p> | ||
235 | |||
220 | <h3 id="math_random">Enhanced PRNG for <tt>math.random()</tt></h3> | 236 | <h3 id="math_random">Enhanced PRNG for <tt>math.random()</tt></h3> |
221 | <p> | 237 | <p> |
222 | LuaJIT uses a Tausworthe PRNG with period 2^223 to implement | 238 | LuaJIT uses a Tausworthe PRNG with period 2^223 to implement |