Last active
June 3, 2022 17:35
-
-
Save Buy-One/dd263d2df61b32a5fe944b989bdd5a14 to your computer and use it in GitHub Desktop.
Merge 2 arrays at index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function merge_2_arrays_at_index(t1,t2,index) -- the result is updated t1 | |
local offset = 1-index | |
for i = index, #t2+index-1 do | |
table.insert(t1, i, t2[i+offset]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment