diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-01-18 15:16:26 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-01-18 15:16:26 -0300 |
commit | 3e9dbe143d3338f5f13a5e421ea593adff482da0 (patch) | |
tree | ce070c600970d216f3a68c78ae9e55d8048ec4ff /manual | |
parent | 4a8e48086433ad12f2991c07f3064278714fd0f1 (diff) | |
download | lua-3e9dbe143d3338f5f13a5e421ea593adff482da0.tar.gz lua-3e9dbe143d3338f5f13a5e421ea593adff482da0.tar.bz2 lua-3e9dbe143d3338f5f13a5e421ea593adff482da0.zip |
New function 'table.create'
Creates a table preallocating memory. (It just exports to Lua the API
function 'lua_createtable'.)
Diffstat (limited to 'manual')
-rw-r--r-- | manual/manual.of | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/manual/manual.of b/manual/manual.of index 48f396d9..42269ff4 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
@@ -3234,11 +3234,11 @@ Values at other positions are not affected. | |||
3234 | 3234 | ||
3235 | } | 3235 | } |
3236 | 3236 | ||
3237 | @APIEntry{void lua_createtable (lua_State *L, int narr, int nrec);| | 3237 | @APIEntry{void lua_createtable (lua_State *L, int nseq, int nrec);| |
3238 | @apii{0,1,m} | 3238 | @apii{0,1,m} |
3239 | 3239 | ||
3240 | Creates a new empty table and pushes it onto the stack. | 3240 | Creates a new empty table and pushes it onto the stack. |
3241 | Parameter @id{narr} is a hint for how many elements the table | 3241 | Parameter @id{nseq} is a hint for how many elements the table |
3242 | will have as a sequence; | 3242 | will have as a sequence; |
3243 | parameter @id{nrec} is a hint for how many other elements | 3243 | parameter @id{nrec} is a hint for how many other elements |
3244 | the table will have. | 3244 | the table will have. |
@@ -7969,6 +7969,19 @@ If @id{i} is greater than @id{j}, returns the empty string. | |||
7969 | 7969 | ||
7970 | } | 7970 | } |
7971 | 7971 | ||
7972 | @LibEntry{table.create (nseq [, nrec])| | ||
7973 | |||
7974 | Creates a new empty table, preallocating memory. | ||
7975 | This preallocation may help performance and save memory | ||
7976 | when you know in advance how many elements the table will have. | ||
7977 | |||
7978 | Parameter @id{nseq} is a hint for how many elements the table | ||
7979 | will have as a sequence. | ||
7980 | Optional parameter @id{nrec} is a hint for how many other elements | ||
7981 | the table will have; its default is zero. | ||
7982 | |||
7983 | } | ||
7984 | |||
7972 | @LibEntry{table.insert (list, [pos,] value)| | 7985 | @LibEntry{table.insert (list, [pos,] value)| |
7973 | 7986 | ||
7974 | Inserts element @id{value} at position @id{pos} in @id{list}, | 7987 | Inserts element @id{value} at position @id{pos} in @id{list}, |