Janet 1.38.0-73334f3 Documentation
(Other Versions:
1.37.1
1.36.0
1.35.0
1.34.0
1.31.0
1.29.1
1.28.0
1.27.0
1.26.0
1.25.1
1.24.0
1.23.0
1.22.0
1.21.0
1.20.0
1.19.0
1.18.1
1.17.1
1.16.1
1.15.0
1.13.1
1.12.2
1.11.1
1.10.1
1.9.1
1.8.1
1.7.0
1.6.0
1.5.1
1.5.0
1.4.0
1.3.1
)
Table Module
Index
table/clear table/clone table/getproto table/new table/proto-flatten table/rawget table/setproto table/to-struct table/weak table/weak-keys table/weak-values
(table/clear tab)
Remove all key-value pairs in a table and return the modified table tab
.
(table/clone tab)
Create a copy of a table. Updates to the new table will not change the old table, and vice versa.
(table/getproto tab)
Get the prototype table of a table. Returns nil if the table has no prototype, otherwise returns the prototype.
(table/new capacity)
Creates a new empty table with pre-allocated memory for capacity
entries. This means that if one knows the
number of entries going into a table on creation, extra memory allocation can be avoided. Returns the new
table.
(table/proto-flatten tab)
Create a new table that is the result of merging all prototypes into a new table.
(table/rawget tab key)
Gets a value from a table tab
without looking at the prototype table. If tab
does not contain the key
directly, the function will return nil without checking the prototype. Returns the value in the table.
(table/setproto tab proto)
Set the prototype of a table. Returns the original table tab
.
(table/to-struct tab &opt proto)
Convert a table to a struct. Returns a new struct.
(table/weak capacity)
Creates a new empty table with weak references to keys and values. Similar to table/new
. Returns the new
table.
(table/weak-keys capacity)
Creates a new empty table with weak references to keys and normal references to values. Similar to table/new
.
Returns the new table.
(table/weak-values capacity)
Creates a new empty table with normal references to keys and weak references to values. Similar to table/new
.
Returns the new table.