Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tab = {1, 2, 3, 4, 5, 6, 7, 8, 9}
- local tArgs = {...}
- function reverseTableSection(tab, start, finish)
- local temp = {}
- local c = 1
- for i = finish, start, -1 do
- temp[c] = tab[i]
- c = c + 1
- end
- c = 1
- for i = start, finish do
- tab[i] = temp[c]
- c = c + 1
- end
- end
- function printTable(t)
- for i = 1, #t do
- write(t[i] .. " ")
- end
- print()
- end
- printTable(tab)
- reverseTableSection(tab, tArgs[1], tArgs[2])
- printTable(tab)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement