Table
This page documents the changes & additions to the table
library in Pluto, which is built on top of Lua 5.4's.
table.sort
This function was modified to return the input table instead of nil
, such that:
local t = { 3, 2, 1 }
t = t:sort(...)
Will not result in t
becoming nil
.
table.sorted
Copying variant of table.sort
; returns a new table instead of modifying the input table. Note that nested tables will not be copied.
table.size
Returns the number of elements in the table, counting both the array part and hash part.
Parameters
- The table to check.
local t = { 1, 2, 3, ["foo"] = "bar" }
print(t:size()) --> 4