blob: ff2ce8701b60adafc419bada2d24779124171554 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
---@meta
--- Returns a shallow copy of the given Lua table.
---
--- This API can be JIT compiled.
---
--- Usage:
---
--- ```lua
--- local clone = require "table.clone"
---
--- local x = {x=12, y={5, 6, 7}}
--- local y = clone(x)
--- ```
---
--- **Note:** We observe 7% over-all speedup in the edgelang-fan compiler's
--- compiling speed whose Lua is generated by the fanlang compiler.
---
--- **Note bis:** Deep cloning is planned to be supported by adding `true` as a second argument.
---
---@param t table
---@return table
local function clone(t) end
return clone
|