Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Update insert.lua
Browse files Browse the repository at this point in the history
Fix indentation because moonwave is fussy.
  • Loading branch information
cxmeel committed Jun 3, 2022
1 parent 18d5508 commit bdabfd2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/Array/insert.lua
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
--!strict
--[=[
@function insert
@within Array
@function insert
@within Array
@param array {T} -- The array to insert the value into.
@param index number -- The index to insert the value at (can be negative).
@param values ...T -- The values to insert.
@return {T} -- The array with the value inserted.
@param array {T} -- The array to insert the value into.
@param index number -- The index to insert the value at (can be negative).
@param values ...T -- The values to insert.
@return {T} -- The array with the value inserted.
Inserts the given values into an array at the given index, shifting all values after it to the right. If the index is negative (or 0), it is counted from the end of the array.
Inserts the given values into an array at the given index, shifting all values after it to the right. If the index is negative (or 0), it is counted from the end of the array.
If the index to insert at is out of range, the array is not modified.
```lua
local array = { 1, 2, 3 }
```lua
local array = { 1, 2, 3 }
local newArray = Insert(array, 2, 4) -- { 1, 4, 2, 3 }
```
local newArray = Insert(array, 2, 4) -- { 1, 4, 2, 3 }
```
]=]
local function insert<T>(array: { T }, index: number, ...: T): { T }
local length = #array
Expand Down

0 comments on commit bdabfd2

Please sign in to comment.