Skip to content

Instantly share code, notes, and snippets.

@Buy-One
Last active June 3, 2022 17:35
Show Gist options
  • Save Buy-One/dd263d2df61b32a5fe944b989bdd5a14 to your computer and use it in GitHub Desktop.
Save Buy-One/dd263d2df61b32a5fe944b989bdd5a14 to your computer and use it in GitHub Desktop.
Merge 2 arrays at index
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